"Alexander Schmolck"
Hi,
I'm trying to figure out what the best way to use boost.test to achieve something close to TDD (test driven development) is; I should presumably also mention that I'm using qmake and not bjam as a build utility.
I've managed to build and use boost.test fine (after figuring out that I needed to add -DBOOST_TEST_DYN_LINK), but what I haven't been able to achieve is to
a) have several smaller test-cases/suites for TDD so that I can rapidly recompile and run a small subset of tests whilst I'm developing a specific class.
b) have one big test-suite, integrating all the above, for regression testing to be run periodically (after the above subset of tests passed; on svn commit etc.)
I haven't figured out how to set things up so that I can compile individual tests to .o files and then either simply build a complete regression suite executable from them or an executable from just one (or a few) of these tests; because I don't know how to use the autoregistration facilities without ending up with multiple main()s.
My test files currently look something like this:
//file foo_test.cpp #define BOOST_TEST_MODULE foo_test #include
#include "foo.h" // Test Suite BOOST_AUTO_TEST_SUITE(foo_test_suite); BOOST_AUTO_TEST_CASE(some_test_case) { // ... } BOOST_AUTO_TEST_SUITE_END();
What's the recommended way to go about this?
Define BOOST_TEST_MODULE only in single file of your multi-file test module. HTH, Gennadiy