Windows Unit Test Runner for boost.test, Google Test and NUnit

boost.test

Here’s a minimal example of a C++ unit test program using boost.test. You can copy the sample code by choosing the Help -> Using Boost Test… menu entry.

unit_test_gui.hpp

A boost.test based unit test needs #include <boost/test/unit_test_gui.hpp> in place of the regular unit_test.hpp header file to support BoostTestUi. The unit_test_gui.hpp file can be created from the File -> Create Header -> Boost Test… menu. Save the header file somewhere in a boost/test subfolder in your include path, typically inside the boost folder itself.

BoostTestUi will detect a boost.test executable without the special #include file and show you a reminder.

BOOST_AUTO_TEST_CASE_ENABLE

BoostTestUi adds the BOOST_AUTO_TEST_CASE_ENABLE(name, enable) macro as an alternative to BOOST_AUTO_TEST_CASE_ENABLE(name). The additional enable parameter accepts a boolean expression that defines the initial enabled state of the test case.

BOOST_TEST_NO_GUI

You wil get linker errors if you #include <boost/test/unit_test_gui.hpp> in more than one source file in your test project. A single source file with unit_test_gui.hpp is enough to support BoostTestUi but you can #define BOOST_TEST_NO_GUI before #include <boost/test/unit_test_gui.hpp> if you want to use BOOST_AUTO_TEST_CASE_ENABLE in other unit test source files too.

If you define your own init_unit_test_suite function instead of using BOOST_TEST_MODULE, it