Next: , Previous: What testing framework does Marsyas use?, Up: Unit tests

2.1.3 How do I add a new test?

The easiest way to add a new test is to copy the file marsyas/src/tests/unit_tests/TestSample.h to a new file of your choice, for example, to “TestAutoCorrelation.h”. “TestSample.h” has sample code in it that will help you get started, and contains copious documentation.

Add new tests for all the parts of your class that you want to test. Remember to start all the new function names with the string “test_” so that CxxTest knows that this function is one that you wish to test.

You then need to add a line to “marsyas/src/tests/unit_tests/CMakeLists.txt” to tell CMake to compile this new file:

     marsyas_unit_test(AubioYin AubioYin_runner.cpp)

In order to generate the AubioYin_runner.cpp file from the TestAubioYin.h file, you then need to run the command: