4

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?

user997112
  • 29,025
  • 43
  • 182
  • 361

1 Answers1

2

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.

sehe
  • 374,641
  • 47
  • 450
  • 633
  • 1
    "Simply do not enable verbose logging." To be fair to the OP, this is a change to existing behaviour. My code suddenly started doing this after I upgraded from v1.71 to v1.74. – cmannett85 Jun 23 '21 at 15:39