Release Notes
Boost release 1.33.0
Boost release 1.32.0
Boost release 1.31.0
Boost release 1.30.0
Migration guide from Boost Test v1
In this release Most of Boost.Test
components undergo a major or significant change in both design and
implementation.
I've strived to keep an interface unchanged as much as
possible. The primary goals for this update were:
- Make a unit test framework better suited for different 'runners'
- Make unit test framework simpler internally by eliminating test cases
hierarchy
- Make test tools more uniform
- Make auto unit test framework as usable as possible
Following are details of what updated/changed specifically in each area of
Boost.Test:
-
Execution Monitor
The execution monitor design changes from inheritance to delegation. If
previously one needed to inherit from the boost::execution monitor to do a
monitored run of a function, now one need to employ an instance of the
boost::execution_monitor
In addition following features implemented:
- Debugger presence detected, in which case catching system errors (SEH) is
disabled unless explicitly enabled. For now only works for msvc family
- Automatic detection of memory leaks introduced. For now only works for
msvc family.
Unit test framework turns this feature on by default.
-
Unit test framework (UTF)
This component of Boost.Test undergo a most dramatic changes in both
design and implementation.
- UTF doesn't employ test cases hierarchy anymore. There is single class
test_case that model one testing unit and class test_suite that model a
collection of test units. Previously UTF employed compound test cases (for
example parameterized test case) which went through it's components (simple
subtests) during testing run time. Now compound test present itself as test
case generator which produce a collection if test_case instances during test
tree construction time. One consequence of this is that user doesn't need to
keep track of compound test case parameters is it used be. test_case now
employs a polymorphic callback to a actual test function. As a result of
this one could supply any zero arity function as an argument of
BOOST_TEST_CASE. So no extra support needed to be able to create
boost::function or boost::bind based tests cases.
- Introduced generic mechanism to traverse the test tree. Anyone willing
to do so just need to implement test_tree_visitor interface and employ
traverse_test_tree. This allows to implement any pre/post processing over
test tree.
- Introduced a notion of framework. The framework is responsible for:
- initializing and providing access to master test suite
- providing access to current test case
- running testing from given test tree node (simple or compound). By default it runs from
root - master test suite. Supports both sequential and random order.
- one may register any test observer agent (implements test_observer
interface) and framework notifies it of all test events
- provides access to any test case based to unique test unit id
- Using the framework one could implement different test runners. UTF library
supplies one console runner (unit_test_main.cpp). But it's possible to do
one winmain based or anything else. For example GUI program that build test
tree and then run tests by request from any point in test tree.
- Unit test log interface changed to single line (used to be begin/end
macros). Unit test log formatter interface changed. How it much simpler and
straightforward. Two supplied implementation are separated.
- Notion of unit test result that was responsible for result collection
and reporting eliminated. Instead introduced independent notions:
results_collector and results_reporter. Results reporting formatter
interface made public. Also results_reporter now allows to change an output
stream.
- Progress monitor functionality (which used to be activated in log
level log_progress) now is an independent test observer and implemented by
class progress_monitor.
- Test case template interface changed. Now user doesn't need to
explicitly register meta class.
- In addition couple more features implemented:
- Added support for test case timing
- UTF made __cdecl - safe
- Result report include skipped tests
- io saver facilities employed to guard against undesirable modification
in output streams formatting
- template test case automatically generate name that includes type name
- --detect_memory_leak and --random command line arguments added
-
Test Tools
- Test Tools interfaces now provide 3 version for each tool:
- CHECK- reports an error if assertion failed
- WARN - reports a warning if assertion failed
- REQUIRE - reports an error if assertion failed and aborts test case execution
- Implementation completely reworked. All tools implemented now through single vararg function
- In addition following modifications made:
- CHECK_COLLECTION interface changed: it now expect 4 arguments
- BITWISE_EQUAL renamed to CHECK_BITWISE_EQUAL; old name still provided,
but is deprecated
- CHECK_COLLECTION interface changed to use PP_SEQ and as a result
support arbitrary(actually maximum is fixed but configurable) number of
predicate arguments
- most of templates eliminated speeding up test modules compilation
- floating-point precision set to include all significant digits
(actually the formula may require some rework since it obviously doesn't do
a good job sometimes)
- BOOST_CHECK/WARN/REQUIRE_SMALL test tool added
- deprecated test tools names are removed
-
Auto unit test framework
- BOOST_AUTO_UNIT_TEST renamed to BOOST_AUTO_TEST_CASE. Old name still
provided but deprecated
- BOOST_AUTO_TEST_CASE_TEMPLATE provides an ability to write a
self-registering test case template
- BOOST_FIXTURE_TEST_CASE provides an ability to write a self-registering
test case with fixture
- BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES provides an ability to specify a
number of expected failures in any self-registering test case
- BOOST_AUTO_TEST_SUITE and BOOST_AUTO_TEST_SUITE_END provide an ability
to structure test cases into self-registering test suites
-
Included components
- Implementation moved from source files (.cpp) under lib/test/src into
implementation files (.ipp) under boost/test/impl to eliminate dependency of
included/minimal components on lib/test/src directory.
- Licence updated to use common Boost software licence
- basic_cstring introduced and used in most places instead of std::string
and char const*
- namespace names gets shorten; old one still supported till next release
- numerous portability workaround for several new supported configurations
- class properties facilities reworked to be more powerful
- added proper encoding of XML PCDATA
- support for wide string comparison implemented
This version of Boost.Test library substitute
the original testing library used in a Boost. These are several simple steps
you need to follow to smoothly migrate to the latest software.
If your code were using the original version
of cpp_main facility, to migrate you will need to delete the inclusion of
the <boost/test/cpp_main.cpp>, since this file is not present any more.
After that you have following choices:
- Link with Program Execution Monitor (exact library name depends on compiler
you are using, but most probably it will be libboost_prg_exec_monitor.lib).
- Include <boost/test/included/prg_exec_monitor.hpp>, in which case
you need not link with precompiled component but it may incur probably
some compile time overhead.
If your code were using the original version
of test_main and test tools facilitates of Boost.Test library, to migrate
to use of latest one you have following choices:
- Without changing of the code that were using Boost.Test facilities link
with Test Execution Monitor (exact library name depends on compiler you
are using, but most probably it will be libtest_exec_monitor.lib).
- Include <boost/test/included/test_exec_monitor.hpp>, in which case
you need not link with precompiled component but it may incur probably
some compile time overhead. Definition of BOOST_INCLUDE_MAIN could be deleted
either.
- Include <boost/test/minimal.hpp>, in which case you need not link
with precompiled component and it most probably does not incur a compile
time overhead, but you will be limited to the set of features defined in
the original test library. Definition of BOOST_INCLUDE_MAIN could be deleted
either. Would you decide in a future to use any of newer Boost Test features
you will be enforced to snitch to one the two chaises above.