@@ -1004,11 +1004,21 @@ calling the `::testing::AddGlobalTestEnvironment()` function:
10041004Environment* AddGlobalTestEnvironment (Environment* env);
10051005```
10061006
1007- Now, when `RUN_ALL_TESTS()` is called, it first calls the `SetUp()` method of
1008- each environment object, then runs the tests if none of the environments
1009- reported fatal failures and `GTEST_SKIP()` was not called. `RUN_ALL_TESTS()`
1010- always calls `TearDown()` with each environment object, regardless of whether or
1011- not the tests were run.
1007+ Now, when `RUN_ALL_TESTS()` is invoked, it first calls the `SetUp()` method. The
1008+ tests are then executed, provided that none of the environments have reported
1009+ fatal failures and `GTEST_SKIP()` has not been invoked. Finally, `TearDown()` is
1010+ called.
1011+
1012+ Note that `SetUp()` and `TearDown()` are only invoked if there is at least one
1013+ test to be performed. Importantly, `TearDown()` is executed even if the test is
1014+ not run due to a fatal failure or `GTEST_SKIP()`.
1015+
1016+ Calling `SetUp()` and `TearDown()` for each iteration depends on the flag
1017+ `gtest_recreate_environments_when_repeating`. `SetUp()` and `TearDown()` are
1018+ called for each environment object when the object is recreated for each
1019+ iteration. However, if test environments are not recreated for each iteration,
1020+ `SetUp()` is called only on the first iteration, and `TearDown()` is called only
1021+ on the last iteration.
10121022
10131023It's OK to register multiple environment objects. In this suite, their `SetUp()`
10141024will be called in the order they are registered, and their `TearDown()` will be
0 commit comments