Boost logo

Boost Users :

From: Perepelitsa Roman (romka_at_[hidden])
Date: 2006-07-18 08:32:31


Hi,

I have implementation of feature which was requested several times. It
allows you to run tests (implemented with the help of boost.tests) by
name.

I attached 3 files.

1. filter.hpp should be copied to boost/test/detail.
2. framework.ipp should be copied to boost/test/impl.
(after copying files you will probably need to rebuild boost.test)
3. example.cpp contains example of usage.

Here is how it works. Each test case receives the name in the form
Suite1/Suite2/.../SuiteN/CaseName. For example there is test cases is
example.cpp with name "Master Test Suite/A/Foo".

Test executable accepts new argument --filter=<regex>. It allows you
to run that and only that tests which names match given regex. Note:
library implicitly adds ".*" to the beginning and to the end of given
regex expression.

For example if you run example.cpp without arguments, you will see:
Foo in A
Bar in A
Foo in B
Bar in B

If you run it with argument "--filter=Foo", you will see:
Foo in A
Foo in B

If you want to run all tests in the suite "A", you can try
"--filter=/A/" or "--filter=^Master Test Suite/A/".

P.S.
You can use this feature without modification of boost.test sources.
Just call boost::test_suite_detail::filter in your implementation of
init_unit_test_suite.

HTH,
Roman Perepelitsa.






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