aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorCopybara-Service <copybara-worker@google.com>2024-01-29 07:50:37 -0800
committerCopybara-Service <copybara-worker@google.com>2024-01-29 07:50:37 -0800
commitfc0076ffc43bfa0edb30160ee2ff74a98b580e35 (patch)
tree98e36022afa804c7d2e86b4ece0d96d402d69106 /docs
parent6a5938233b6519ba99ddb7c7314d45d3fa877969 (diff)
parent1cab76c7b80756c42008fc36870146c8e38507de (diff)
downloadgoogletest-fc0076ffc43bfa0edb30160ee2ff74a98b580e35.zip
googletest-fc0076ffc43bfa0edb30160ee2ff74a98b580e35.tar.gz
googletest-fc0076ffc43bfa0edb30160ee2ff74a98b580e35.tar.bz2
Merge pull request #4435 from kaswhy:main
PiperOrigin-RevId: 602385832 Change-Id: I755dae5707e98b6157930a74de90a8e19ef17603
Diffstat (limited to 'docs')
-rw-r--r--docs/advanced.md20
1 files changed, 15 insertions, 5 deletions
diff --git a/docs/advanced.md b/docs/advanced.md
index 0e1f812..2ecce63 100644
--- a/docs/advanced.md
+++ b/docs/advanced.md
@@ -1004,11 +1004,21 @@ calling the `::testing::AddGlobalTestEnvironment()` function:
Environment* AddGlobalTestEnvironment(Environment* env);
```
-Now, when `RUN_ALL_TESTS()` is called, it first calls the `SetUp()` method of
-each environment object, then runs the tests if none of the environments
-reported fatal failures and `GTEST_SKIP()` was not called. `RUN_ALL_TESTS()`
-always calls `TearDown()` with each environment object, regardless of whether or
-not the tests were run.
+Now, when `RUN_ALL_TESTS()` is invoked, it first calls the `SetUp()` method. The
+tests are then executed, provided that none of the environments have reported
+fatal failures and `GTEST_SKIP()` has not been invoked. Finally, `TearDown()` is
+called.
+
+Note that `SetUp()` and `TearDown()` are only invoked if there is at least one
+test to be performed. Importantly, `TearDown()` is executed even if the test is
+not run due to a fatal failure or `GTEST_SKIP()`.
+
+Calling `SetUp()` and `TearDown()` for each iteration depends on the flag
+`gtest_recreate_environments_when_repeating`. `SetUp()` and `TearDown()` are
+called for each environment object when the object is recreated for each
+iteration. However, if test environments are not recreated for each iteration,
+`SetUp()` is called only on the first iteration, and `TearDown()` is called only
+on the last iteration.
It's OK to register multiple environment objects. In this suite, their `SetUp()`
will be called in the order they are registered, and their `TearDown()` will be