Boost logo

Boost Users :

From: Mateusz Łoskot (mateusz_at_[hidden])
Date: 2006-03-05 16:50:50


Hi,

I'd like to ask yet another questions related to Unit Test Framework
usage. Especially, I'm interested in best practice of Unit Tests
organization in the project.

I have a project that consists of more than 100 classes.
Some of those classes are general purpose (e.g. Point) but some are
organized in components (e.g. spatial index component consisting of 5
classes).

Now, I'd like to add Unit Tests (yes, I know I should have them prepared
before I created those classes ;-)).

I've read almost all docs about Boost.Test, downloaded from CVS.
I know how to create Test Case and how to combine those cases into Test
Suite. I also read introductory docs from "Tutorials and usage
recommendations" part as well as I walked through unit_test_examples but
I'm still a bit confused about the bigger picture.

As far as I understand, every Test Case or Test Suite of cases is to be
compiled to separate executable. Is this correct?
So, unit_test_example_01.cpp and unit_test_example_02.cpp and so on
create separate programs that can be executed e.g. from Visual Studio
Post-Build Event as explained in docs.

More precisely, every .cpp file that:
- include #include <boost/test/unit_test.hpp>
- uses defines cases using BOOST_AUTO_TEST_CASE
- or defines suites of cases using BOOST_TEST_SUITE + BOOST_AUTO_TEST_CASE

will be a separate program. Right?

So, if I have 100 classes and I'd like to define Test Suite,
with a number of Test Cases in every suite, for every my class
then should I expect I will get 100 test executables?

 From Visual Studio point of view, I will have 100 projects in my test
solution. Am I right?

I feel I don't understand something, so I'd be very thankful for some
light on this subject.

So, what is the best way to organize Test Cases and Suites for my 100
classes? Should I try to build them into one executable or into number
of separate executables as described in my assumptions above?

If there are e.g. 100 executables for my 100 tests, how should I run
them e.g. during complete rebuild of project using automake or bjam?
Not using Visual Studio Post-Build Events, should I run those tests from
makefiles/jamfiles or there is a kind of test runner program I can use?

Best regards

-- 
Mateusz Łoskot
http://mateusz.loskot.net

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