Boost logo

Boost Users :

From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2007-08-14 00:36:27


"Alexander Schmolck" <a.schmolck_at_[hidden]> wrote in message
news:yfsfy2n5sox.fsf_at_gmx.net...
> 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 <boost/test/unit_test.hpp>
> #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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net