I have a Class A
(implemented in A.cpp
and A.h
). I have created a file testA.cpp
and implemented tests for the class A. testA.cpp basically has the form:
#define BOOST_TEST_MODULE TestA
...
BOOST_AUTO_TEST_SUITE(test_suite_A)
...
BOOST_AUTO_TEST_CASE(testA1) { ... }
BOOST_AUTO_TEST_CASE(testA2) { ... }
BOOST_AUTO_TEST_CASE(testA3) { ... }
...
BOOST_AUTO_TEST_SUITE_END()
This generates all that is needed to run the tests (the main file, etc.)
Now I would like to add an additional class B
(implemented in B.cpp
and B.h
) and implement an additional test suit for B in testB.cpp
and extend my test module to contain TestA
and TestB
.
Must I give up at least autogeneration of the main function that registeres the test suits if the test suits reside in different files? How can I organize the suits so I can easily switch on/off individual suits?
Currently I found the following solution for the problem:
#define BOOST_TEST_MODULE Tests #include "testA.cpp" #include "testB.cpp"
the include CPP Files contain individual test suits. Any better solution is very welcome