
Hello Gennadiy, I have a question on may be existing or potential feature. I works with a group of developers on a huge project. Our current intention is to test some (huge) software parts on the target using boost::test framework. Unfortunately the software produces some gigs of executables, so that we can not (and probably should not test all of them). I know we could group the test cases into the test suites and build dependencies between them, but that requires a lot of time for the system, which is being developed for some years. Speaking with the collegues I came accross an issue to write test code inbetween the productive code and include only required files in the final test suites. Is it an utopic idea and do you think that could be implemented in boost::test? A small example: productive_header.h productive_impl.cpp some class defined here this class implemented here some use cases declared here & compiled if test code compilation test case implementations here as well After all I can compile: <productive executable> without tests by simply including productive_header.h <test executable> with test by defining BOOST_TEST_MAIN and including productive_header.h May be this already works so and you can point me to the documentation, where it is stated. Many thanks, Ovanes

Ovanes Markarian wrote: A small example:
productive_header.h productive_impl.cpp some class defined here this class implemented here some use cases declared here & compiled if test code compilation test case implementations here as well
After all I can compile:
<productive executable> without tests by simply including productive_header.h
<test executable> with test by defining BOOST_TEST_MAIN and including productive_header.h
May be this already works so and you can point me to the documentation, where it is stated.
I am not sure what prevents you from doing this. This should work without problems. In fact if you really want you production code to match your test one, you can build all you production code along with all test cases into shared libraries and than use boost_console_test_runner to execute the tests. Gennadiy

Gennadiy, many thanks for your answer. Is there a doc, on how to do this or should I figure it out myself? With Kind Regards, Ovanes
I am not sure what prevents you from doing this. This should work without problems. In fact if you really want you production code to match your test one, you can build all you production code along with all test cases into shared libraries and than use boost_console_test_runner to execute the tests.
Gennadiy

I just wanted to make a small addition to my post. Please see below.
On Mon, May 5, 2008 at 9:34 AM, Ovanes Markarian
Gennadiy,
many thanks for your answer. Is there a doc, on how to do this or should I figure it out myself?
With Kind Regards, Ovanes
I am not sure what prevents you from doing this. This should work without problems. In fact if you really want you production code to match your test one, you can build all you production code along with all test cases into shared libraries and than use boost_console_test_runner to execute the tests.
Gennadiy
Since our executables (total sum) are pretty big (around 2 gigs) we do not want the unit test code to be compiled into the production code, since it can easily increase the size. So my question was of the nature: Can I somehow without writing own macros, use the Test Framework macros, which will remove the entire test code from compilation unit or do I have to enable / disable it via an own macro definitions a la:
#if defined PP_WITH_UNIT_TESTS BOOST_AUTO_TEST_CASE(some_test) ... #endif And the other question is: can I make hierarchical test dependencies with BOOST_AUTO_TEST_CASE. The problem is, it is not always a good idea run all unit tests, because of timing aspects. With Kind Regards, Ovanes

Ovanes Markarian wrote:
Since our executables (total sum) are pretty big (around 2 gigs) we do not want the unit test code to be compiled into the production code, since it can easily increase the size. So my question was of the nature: Can I somehow without writing own macros, use the Test Framework macros, which will remove the entire test code from compilation unit or do I have to enable / disable it via an own macro definitions a la:
#if defined PP_WITH_UNIT_TESTS BOOST_AUTO_TEST_CASE(some_test) ... #endif
The answer is no. You will have to use your own macro. I can't imagine why would u want Boost.Test support for that.
And the other question is: can I make hierarchical test dependencies with BOOST_AUTO_TEST_CASE. The problem is, it is not always a good idea run all unit tests, because of timing aspects.
Not sure what you mean exactly. But with 1.35 you can: 1. Define multilevel hierarchies of test suites and test cases 2. Add dependency of one test unit to any other test unit in a test tree 3. run any set of test units selected by their name, including single test case, single test suite. Gennadiy
participants (2)
-
Gennadiy Rozental
-
Ovanes Markarian