c++boostboost-test

Boost Test output spamming with "disabled" when running named test


I'm running a Boost Test test/suite by name, using:

./MyTestExe --run_test=my_test

Unfortunately i'm getting hundreds of:

"Test case "bla" is skipped because disabled"

But I didn't disable it, I simply chose to not run it.

Is there a way to remove all these messages? However, if possible I would like to keep them for when I run everything and a test is actually disabled?


Solution

  • Would have been nice to provide a repro.

    So I made the simplest one:

    #define BOOST_TEST_MODULE test module name
    #include <boost/test/included/unit_test.hpp>
    
    BOOST_AUTO_TEST_SUITE(Suite)
        
        BOOST_AUTO_TEST_CASE(A) {
            BOOST_TEST_MESSAGE("Yo A");
            BOOST_TEST(1 == 3);
        }
    
        BOOST_AUTO_TEST_CASE(B) {
            BOOST_TEST_MESSAGE("Yo B");
            BOOST_TEST(1 == 1);
        }
    
        BOOST_AUTO_TEST_CASE(C) {
            BOOST_TEST_MESSAGE("Yo C");
            BOOST_TEST(3 == 3);
        }
    
    BOOST_AUTO_TEST_SUITE_END()
    

    Which prints Live On Coliru

    enter image description here

    Now let's run only test case C: ./a.out -t Suite/C: Live On Coliru

    enter image description here

    In order to actually see the informational messages you mention, you have to ask for it:

    a.out -t Suite/C -l all Live On Coliru

    enter image description here

    The options are:

      log_level
        Specifies the logging level of the test execution.
        --log_level=<all|success|test_suite|unit_scope|message|warning|error|cpp_exception|system_error|fatal_error|nothing>
        -l <all|success|test_suite|unit_scope|message|warning|error|cpp_exception|system_error|fatal_error|nothing>
    

    Turns out you need at leat unit_scope or test_suite to see it. If you just want to see your own informationals, use -l message: Live On Coliru

    enter image description here

    Conclusion:

    Simply do not enable verbose logging.

    Note it is possible that the log configuration is made somewhere implicitly. E.g. in a custom runner entry point or read from a configuration file. Also, if this is on some kind of CI server, check your build/CI scripts.