googletest icon indicating copy to clipboard operation
googletest copied to clipboard

Detect and report Rotten Green Tests

Open pogo59 opened this issue 8 months ago • 2 comments

Rotten Green Tests are tests that have assertions that did not execute, even though they were contained in a test method that has a Pass result. This patch detects and reports such assertions contained in a TEST or TEST_F method, if the method result is Pass. Skipped, disabled, or otherwise not-run tests are not analyzed for rotten assertions.

By default, Rotten assertions do not count as a failure. Use --gtest_treat_rotten_as_pass=0 to make rotten tests into failures. This is customizable.

Rotten assertions in helper functions are also reported if the overall result of the test program was Pass.

Currently, TEST_P, TYPED_TEST, and TYPED_TEST_P are treated as if they were helpers, for Rotten reporting purposes. This can lead to false positives for these kinds of Test methods, especially if they are skipped, disabled, or otherwise not run.

pogo59 avatar May 31 '24 16:05 pogo59