diff options
author | kaswhy <sxshx818@naver.com> | 2024-01-23 12:39:40 (GMT) |
---|---|---|
committer | kaswhy <sxshx818@naver.com> | 2024-01-23 12:39:40 (GMT) |
commit | 1cab76c7b80756c42008fc36870146c8e38507de (patch) | |
tree | 9beaac5634e8a7cf292662f618fa38b349632b75 /docs | |
parent | 778badf63a6459b15c237ffad798ef9a484e84fe (diff) | |
download | googletest-1cab76c7b80756c42008fc36870146c8e38507de.zip googletest-1cab76c7b80756c42008fc36870146c8e38507de.tar.gz googletest-1cab76c7b80756c42008fc36870146c8e38507de.tar.bz2 |
Docs: Add mention of `gtest_recreate_environments_when_repeating`refs/pull/4435/head
Diffstat (limited to 'docs')
-rw-r--r-- | docs/advanced.md | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/docs/advanced.md b/docs/advanced.md index ff50eda..715bd04 100644 --- a/docs/advanced.md +++ b/docs/advanced.md @@ -1004,18 +1004,20 @@ calling the `::testing::AddGlobalTestEnvironment()` function: Environment* AddGlobalTestEnvironment(Environment* env); ``` -Now, when RUN_ALL_TESTS() is invoked, it first calls the SetUp() method. +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 itself -is not run due to exception handling (e.g., fatal failures or if GTEST_SKIP() is invoked). - -SetUp() and TearDown() are also called for each environment object when they are -recreated for each iteration. However, if the 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. +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 +`gtest_recreate_environments_when_repeating variable`. `SetUp()` and `TearDown()` +are called for each environment object when they are recreated for each iteration. +However, if the 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 |