google / googletest

GoogleTest - Google Testing and Mocking Framework
https://google.github.io/googletest/
BSD 3-Clause "New" or "Revised" License
33.68k stars 9.98k forks source link

What is the correct way to report an error from an Environment teardown? #4520

Closed peakschris closed 2 months ago

peakschris commented 2 months ago

Describe the issue

We have an Environment teardown that is reporting an error and we need to know what the correct approach is to handle it. Our current code throws an exception and this results in no test log emitted for any of the test cases which ran correctly. Calling FAIL() inside the teardown function has the same result. We would like for the test log to be created, but for some global failure to be reported in it. We would prefer not to hide the error completely.

Please would you advise?

Steps to reproduce the problem

add throw to Environment TearDown() or call to FAIL()

What version of GoogleTest are you using?

na

What operating system and version are you using?

Windows

What compiler and version are you using?

msvc 16

What build system are you using?

bazel 6.0.0

Additional context

No response