-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit testing framework #4
Comments
|
Just to reiterate, we’re targeting this API. There doesn’t seem to be any “official” BQN unit testing framework though there are obviously tests in the BQN source. The API is mostly about how test results are reported more than how they are run. Poking around some other test runners people seemed to be able to adapt pre-built frameworks to the API, so following some best practices will probably get us there. @razetime points out that the J test runner uses a well established framework written in an array language. That may be the easiest to adapt but no decisions have been made yet. |
FWIW, creating the actual runner is mostly Docker work, which is probably a separate task from making a framework for creating tests and producing summaries of the results. It’s probably best to leave that for another issue. |
One reference we can use is the Fortran test runner |
One idea from @RocketRace was to have a way to group tests, similar to most languages. pass/fail data is kept in each namespace.
I have a different idea, storing everything within the library namespace. |
I think you are imagining building a testing framework and adding an exercism track at the same time.
I don't think assertions for errors and whatnot are priorities. If anyone (including one of us) has written a testing framework soon enough, we can simply use it. Unless that's the case though, I don't think we'll need more than ≡ or ⎊for exercism tests.
So basically, I think any idea will work. Lets just pick one and go with it :) But w/ regards to how comprehensive a testing framework we have, I think we need very little. |
Yeah basic assertions should do well enough for tests, but there seems enough incentive to add some simple grouping for assertions. |
I come from a school of writing tests where each test has a single assertion, so the need to group didn't initially occur to me. But I understand the need. Could we open a And I also feel like some of these may be easier to build than to discuss :) So I will simply say I will follow the decisions taken and figure out what I can contribute to them. |
i think an immediate block is not as useful, we need something like
and so on, so we can store test data. It can only be advantageous anyway since we will need to pretty print it and also use it for the test runner |
beginnings of this framework are at https://github.com/razetime/bqn-unit. react to this post for an invitation. |
I think BQN has all the syntax necessary to write tests and that we genuinely don't need much more utils besides a pretty diff printer. And I understand the desire to group multiple assertions under one test but it's neither a need nor is it commonly recommended: So we really don't need to do stuff like this:
Because one assertion is(should be) enough for each test:
Where |
The thing is, eventually we may have to link the test data into the runner. So now I am thinking it is better that we have a list of namespaces, like so. For what it's worth, not too complicated and based on ideas from minitest:
This way we have test data usable elsewhere, and a script that runs the tests with args. If this sounds good, I will continue with it in razetime/bqn-unit and complete it very soon. |
I still feel like this API is too verbose. Do you have an example for how you'd write tests for a real-life modulle? |
hmm, yeah, it is verbose. Namespaces are a little nicer than having global state. however. the point is
If you have a better idea for doing the same, we can try that.
|
OK, I'll very quickly and briefly share my idea for the framework with little regard for what we have:
|
ok, this seems good for now. |
Let’s use this issue to discuss plans for a unit testing framework. There are probably enough decisions to be made to split this off the head issue.
The text was updated successfully, but these errors were encountered: