-
Notifications
You must be signed in to change notification settings - Fork 107
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 #176
Comments
I think your framework does exactly what we need and stays out of the way. Good to have this thread open for discussion, but unless concrete problems arise I don't think we need to look further for now. |
I was going to suggest vegetables at some point, as it solves those problems. I also like it because it encourages the test descriptions to read more like a requirements specification. Your framework is actually fairly similar in terms of definition/registration of the tests, so I wasn't worried about switching, and if we do need to the transition won't seem very awkward. I also have a tool with it that automates finding all the test suites and constructing the main program.
I wouldn't recommend this. It makes the output of the framework dependent on the order that it runs the tests. If the tests are independent (and they should be), the order that they're run shouldn't have any bearing on the outputs.
I've used vegetables for a project that had hundreds of tests. I don't know if fpm will have more than that, but it seems to me more likely to hit the continuation line limit before any array constructor limit (assuming there is one). |
I'm happy with your framework since it's lightweight and easy to use as a developer. I usually split test suites between multiple executables (hence #164) for two reasons:
With that said, I don't mind the current single-executable approach since our tests don't have any significant runtime. |
Agreed, a failing test suite should not stop the testing. I'll address this in #177. |
In my Ftnunit unit test package I use a small batch file/shell script to
repeatedly run the test executable in case of run-time failures. It relies
on a small file being updated and read before each test to see if that test
needs to be run or has already been run. The problem is that if a test
leads to a crash of the program, you simply cannot continue and this
mechanism works around that.
Op wo 16 sep. 2020 om 11:01 schreef Sebastian Ehlert <
[email protected]>:
… Agreed, a failing test suite should not stop the testing. I'll address
this in #177 <#177>.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#176 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN6YR6FY65K6RHDZTADFPTSGB5FLANCNFSM4RNZK6LQ>
.
|
In case of a test crashing we would have to run it with We could have something like the [[test]]
name = "tester"
build-script = "collect-tests"
test-script = "run-tests"
|
I am ok with any testing framework for As long as |
Related to fortran-lang/stdlib#162 and fortran-lang/stdlib#345, I am wondering whether there is motivation to extract the lightweight unit testing framework as a separate fpm package? I liked it enough to incorporate a version of it in my fhash package, and @awvwgk is similarly maintaining a version in mctc-lib. With a cmake configuration it could also be adopted by stdlib. What do people think? |
The mctc library already offers a CMake integration for the testing framework here to allow parallelisation over the testsuites and the individual unit tests. I think neither fpm nor stdlib want to depend on a computational chemistry IO library for testing, so spinning of a new project is the way to go. I didn't made it its own project yet because it's an awful lot of work to maintain those and most of my use cases are covered with the mctc library now. If you are interested in co-maintaining such a project under the @fortran-lang namespace, I'll setup a project for this purpose. |
Awesome. Yep I'm happy to help co-maintain this. Having it under the fortran-lang namespace seems like a good idea as it is used by fpm and it would hopefully encourage people to write tests for their new fpm packages! |
I separated the testing framework from the mctc library to the repository here https://github.com/awvwgk/test-drive. It is currently very rudimentary but should already be working more or less. |
Awesome, thanks! Fpm is under MIT license, is there a reason to change the tests to to Apache? It's probably a relatively minor issue, but I don't have that much experience with Apache. Also I feel the less licenses types we use under fortran-lang, the better. |
I prefer Apache over other permissive licenses because it actually contains clauses that cover contributions to the project and offers some basic protection for the copyright holder, which is the basic minimum I'm expecting from a open source license I'm putting on a project I'm personally responsible for. |
All right then. I think Apache is fine. You should also ask anybody who contributed to this code if they are ok with the license change. |
No worries there, the relevant part in fpm is still in its original form: https://github.com/fortran-lang/fpm/blame/master/fpm/test/fpm_test/testsuite.f90, but it was not used to spin off the test-drive project in the first place anyway. |
I seems like we will stay with my (temporary) testing framework for now. I'm actually surprised that this idea worked out.
Nevertheless, we should discuss if there might be better alternatives or in case we want to stay with the current model, how it should behave as we implement more test suites. If we want to allow preprocessor or external (non-Fortran) dependencies we have a much wider range of testing frameworks available.
Regarding the current behaviour of the testing framework:
[[test]]
entries infpm.toml
(related to Automatically discover executables & tests #164)The text was updated successfully, but these errors were encountered: