Uh oh!
There was an error while loading. Please reload this page.
Custom assertions - #7
Conversation
ggorlen
commented
Jun 20, 2020
I'm not married to this design at all--it might be easier for the user and to integrate state into the |
kazk
commented
Jun 20, 2020
Yeah, it's difficult because of the original design. If we can start over, we can simplify all this to:
|
ggorlen
commented
Jun 20, 2020
Yeah, it's not hard to do this with a bit of redesign and keeping state differently. Just give a holler if you want me to work on it. I'm sure there's a good reason for it, but I guess unittest has to be adapted to work with the runner so that the proper stdout can be printed? |
kazk
commented
Jun 20, 2020
Do you mean the reason behind the original design? I don't think there was any "design" and that's the problem. If I remember correctly, Codewars test framework was created for JavaScript in the early days and it was decided that other languages should also have the similar API so custom frameworks for Ruby and Python were also written in the same way.
I'm not sure how it can be adapted, but I'm interested if you have some idea in mind. I was thinking maybe we can change how the assertions work only when it's used inside |
ggorlen
commented
Jun 20, 2020
I don't have an idea for making unittest work with the necessary CW stdout elements but I figured there was some trick that Q uses for this and could be adapted for CW as well. Yeah, the simplified flow is promising but I think it'd take a bit of a redesign that felt invasive to propose. The current approach prints |
kazk
commented
Jun 20, 2020
No, Q just uses
I think changing to a single |
kazk
commented
Jun 20, 2020
Let's discuss and do small experiments before actually working on it. Also, we should have some tests set up. Something like: And compare the actual output against the expected after removing things that's expected to be different like durations. |
ggorlen
commented
Jun 20, 2020
I like the single On tests, yes--I was thinking of this when working on the repo. Right, that makes sense for unittest, but I'm still not quite understanding why the same strategy isn't available for CW--backwards compatibility locks in the custom library, though. |
kazk
commented
Jun 20, 2020
Can you elaborate on the same strategy? I don't think I'm following. Qualified have the same problem. |
ggorlen
commented
Jun 20, 2020
Isn't it possible to use both unittest with a customer reporter alongside CW/Q unit tests? I know there is a dropdown option, but I'm assuming ultimately they have to emit the same stdout tags that the runner needs to display the results, so I assume that it's possible to plug n play different test libraries with the runner, as long as they ultimately generate the right standard output. |
That should be possible. Just need to also include the code to set up the custom reporter and to run the tests. You actually don't even need to use any code from this repo or In the future, Codewars will allow authors to choose the test framework to use just like Qualified. |
No description provided.