catchorg / Catch2

A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
https://discord.gg/4CWS9zD
Boost Software License 1.0
18.65k stars 3.05k forks source link

Make "Randomness seeded to: X" message optional? #2664

Open alabuzhev opened 1 year ago

alabuzhev commented 1 year ago

Description Currently the message in unconditional: https://github.com/catchorg/Catch2/blob/1f881ab4641b866304b818a063164dae976dba5f/src/catch2/reporters/catch_reporter_console.cpp#L514-L521

So it is shown every single time:

Randomness seeded to: 784548612
===============================================================================
All tests passed (5147 assertions in 174 test cases)

Not denying that this feature is supposedly important in certain use cases, I don't explicitly use Catch2's RNG in my tests and could not care less to what exactly the randomness was seeded, so the message only distracts.

I'd expect it to be exposed by xml and other machine-readable reporters, and even by console when --verbosity high is set, why not, but doing so unconditionally and by default is just annoying.

Thanks

Rosauce commented 1 year ago

image (5)

The optimized code includes two additional conditionals based on configuration options specified by the user. The first checks if the user has requested that any test filters be displayed in the console output. The second checks if the user has requested that the random seed used for the test run be displayed in the console output.