Boost Test Library: release rotes

Boost.Test > Release Notes

# Release Notes

## Boost release 1.33.0

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:

1. ### 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.

2. ### 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

3. ### 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

4. ### 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

5. ### 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.

## Boost release 1.32.0

- 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

## Boost release 1.31.0

- Zero arity function template based test case
- Custom exception translators support in execution monitor and register_exception_translator added for unit test framework
- Test cases dependency support
- Added support for multi-module unit tests in automatic registration facility
- Floating point comparison algorithm reworked (Is not backward compatible!!!)
  - tolerance now expected in percent units
  - eliminated tolerance definition by number of rounding errors
  - switch to comparison type enumeration instead of boolean value
- First failed assertion support
- Major documentation structure rework and update
  I hope you will find handy new navigation system
- Switched to new boost license
- Added support for custom users predicate returning both boolean result code and possibly error message
- BOOST_CHECK_EXCEPTION test tool introduced - to perform complex validation of expected exception
- BOOST_IGNORE_CHECK test tool introduced - to be used with BOOST_CHECK_EXCEPTION
- Straiten return code logic for Program Execution Monitor and in case of failed initialization in Unit Test Framework
- Added position in the collection comparison results error message
- Disable SEH if BOOST_DISABLE_WIN32 in effect
- Como can't do structured exceptions
- Added support for catch_system_error in Test Execution Monitor
- Move log formatter in public interface
- Custom char value log print procedures
- Support for logging variable values of types that does not support operator<<
- match_pattern updated to show an error mismatch snippet
- force UNIX slash for file name
- Some annoying MSVC warnings suppressed
- test_case_scope_tracker introduced for correct exception unwinding handling
- unit_test_result_tracker introduced for correct exception handling
- several minor bug and warnings fixes

## Boost release 1.30.0

- Facility for automatic registration of unit tests is introduced
  It was requested during original Boost Test review and now it supports automatic registration for free function based test cases. Here an example:

      #include <boost/test/auto_unit_test.hpp>

      BOOST_AUTO_UNIT_TEST( test1 )
      {
        BOOST_CHECK( true );
      }

      BOOST_AUTO_UNIT_TEST( test2 )
      {
        BOOST_CHECK( true );
      }

- XML log format is introduced
  Now user willing to automate errors processing could get a log in XML format. Command line switch is introduced that manage log format:
  --log_format=[XML|HRF] will force XML or human readable format respectively
- XML report format is introduced
  Now user willing to automate results analysis could get a result report in XML format. Command line switch is introduced that manage report format:
  --report_format=[XML|HRF] will force XML or human readable format respectively
- BOOST_CHECK_NO_THROW test tool is introduced
- BOOST_BITWISE_EQUAL test tool is introduced
- libraries file names changed to:
  boost_prg_exec_monitor
  boost_test_exec_monitor
  boost_unit_test_framework
- Components examples and test documentation page is introduced
  Now all test/examples links lead to this page that has summary information about all of them, that include expected output, type of test and so on
- Catch system errors switch introduced
  This will work among the lines described in http://lists.boost.org/MailArchives/boost/msg40028.php
  Environment variable name: BOOST_TEST_CATCH_SYSTEM_ERRORS[="no"]
  Unit test framework command line argument: --catch_system_errors[="no"]
- Added building dynamic libraries into Jamfile
- MS C runtime debug hooks introduced
  It allows to catch _ASSERT bases assertion for MSVC
- SIGABRT catch added
- Eliminated NULLs all over the place
  I switched to use typedef c_string literal instead of char const* and to c_string literal() instead of NULL. Different definition of NULL symbol causing small problems for some compilers
- class wrapstrstream separated in standalone file and renamed to wrap_stringstream
  For now it will be located in test/detail. Once I prepare doc page for it I will present it for adding into utility
- unit_test_result_saver introduced to properly managed reset_current_test_set calls in case of exceptions
- switch back to use scoped_ptr instead of raw test_suite pointer in unit_test_main.cpp
- BOOST_CPP_MAIN_CONFIRMATION renamed to BOOST_PRG_MON_CONFIRM and changed it's logic a bit
  It now should have value "no" to turn off pass confirmation
- added tests for auto unit test facility and catching assert statements
- Jamfile added info examples directory
- Added example input for the unit_test_example5
- Command line option --output_format is introduced that both log/report format simultaneously
- Allows to perform bitwise comparisons of the two arguments provided. Will report as many errors as many bits mismatch. Mismatch position is reported.
- Documentation default palette changed to white
- Signal handling selection algorithm fixed
  BOOST_HAS_SIGACTION is used to select sigaction based signal handling alternative. It allowed use of signal handling with gcc on win32 platform.
- C strings usage in minimized as much as possible
- class_properties header modified to use Boost.Preprocessor for friends declaration
- other minor code/doc changes and bug fixes

## Boost Test migration guide

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.