BOOST_TEST_MESSAGE

| > The Unit Test Framework > User's guide > Test Output > Test log > BOOST_TEST_MESSAGE |

###### BOOST_TEST_MESSAGE

The macro BOOST_TEST_MESSAGE is intended to be used for the purpose of injecting an additional message into the UTF test log. These messages are not intended to indicate any error or warning conditions, but rather as information/status notifications. The macro signature is as follows:

    BOOST_TEST_MESSAGE(test_message)

The test_message argument can be as simple as C string literal or any custom expression that you can produce with in a manner similar to standard iostream operation.

| Important
Messages generated by this tool do not appear in test log output with default value of the active log level threshold. For these messages to appear the active log level threshold has to be set to a value below or equal to "message".

Example 27. BOOST_TEST_MESSAGE usage

    #define BOOST_TEST_MODULE example
    #include <boost/test/included/unit_test.hpp>

    //____________________________________________________________________________//

    BOOST_AUTO_TEST_CASE( test_init )
    {
        int current_time = 0; // real call is required here

        BOOST_TEST_MESSAGE( "Testing initialization :" );
        BOOST_TEST_MESSAGE( "Current time:" << current_time );
    }

    //____________________________________________________________________________//

    BOOST_AUTO_TEST_CASE( test_update )
    {
        std::string field_name = "Volume";
        int         value      = 100;

        BOOST_TEST_MESSAGE( "Testing update :" );
        BOOST_TEST_MESSAGE( "Update " << field_name << " with " << value );
    }

    //____________________________________________________________________________//

`Source code` | | | `Show output`

    > example --log_level=message
    Running 2 test cases...
    Testing initialization :
    Current time:0
    Testing update :
    Update Volume with 100

    *** No errors detected