Closed jakobj closed 6 years ago
Adding C++ tests is a good idea. We should evaluate carefully existing options. Boost.test also appears to be quite popular, as well as Catch. I found some relevant discussion here:
Several discussion contributions point out that good mocking support is equally important as good test support. My impression from a first look is the Ctest is not a test framework, but rather a mechanism for running tests from Eclipse.
I've started working on including boost.test, which seems like a good solution. For mocking there is turtle, apparently working great with boost. you can find the current progress in my fork under the feature/cpptest branch. let me know what you think and what a good demonstration would look like. should we port the librandom test to the new framework?
to be able to run the tests, you need to compile NEST with libboost, for which I added a new cmake option: -Dwith-boost
. cmake should find the corresponding headers and libraries automatically and list them in the configuration summary. after compiling NEST you will find a new executable run_all_cpptests
in the bin folder. you can also pass command like flags to this executable like --report_level=detailed
to get more information on which tests were run. I have not added this to the regular testsuite yet, but that should work without any issues.
This is in place with NEST 2.16.0.
In order to expand our testsuite with standardized unittest for c++ functions (see, e.g., librandom), we need to include a c++ testing framework into NEST's tests. Currently, we consider ctest and google test. Both have compatible licenses (BSD like). We need to make sure that the testsuite can run on many differeny systems, since NEST is run on laptops, a variety of clusters and supercomputers. I will investige the two framework mentioned above and report back here. Any advice, suggestsions etc are welcome.