C++ Catch unit tests with junit reporter misses tests without any output

49 views Asked by At

My C++ project uses the Catch2 unit test framework. The tests are run using the following command:

utest -r junit

The output from this command is missing for many of my unit tests, even though they all use the "TEST_CASE" macro the same way. In fact, if I run utest without the "-r junit" option, it reports the correct number of passing tests (all of them).

After much trial and error, I found that the one thing that all of the tests that are missing from the junit output have in common is that none of them produce any terminal output. They all have REQUIRE lines, so they should all be valid tests.

If I add the following line to any of the problem tests:

std::cerr << "Hello";

... then they are present in the junit output and everything is good.

I don't want to have to put these dummy output commands in every test case, and future me and other developers may forget to do that.

Why is it doing this, and how can I solve this issue correctly?

0

There are 0 answers