googletest/googletest/docs
Enji Cooper 67c75ff8ba Handle GTEST_SKIP() when calling Environment::SetUp()
gtest prior to this change would completely ignore `GTEST_SKIP()` if
called in `Environment::SetUp()`, instead of bailing out early, unlike
`Test::SetUp()`, which would cause the tests themselves to be skipped.
The only way (prior to this change) to skip the tests would be to
trigger a fatal error via `GTEST_FAIL()`.

Desirable behavior, in this case, when dealing with
`Environment::SetUp()` is to check for prerequisites on a system
(example, kernel supports a particular featureset, e.g., capsicum), and
skip the tests. The alternatives prior to this change would be
undesirable:

- Failing sends the wrong message to the test user, as the result of the
  tests is indeterminate, not failed.
- Having to add per-test class abstractions that override `SetUp()` to
  test for the capsicum feature set, then skip all of the tests in their
  respective SetUp fixtures, would be a lot of human and computational
  work; checking for the feature would need to be done for all of the
  tests, instead of once for all of the tests.

For those reasons, making `Environment::SetUp()` handle `GTEST_SKIP()`,
by not executing the testcases, is the most desirable solution.

In order to properly diagnose what happened when running the tests if
they are skipped, print out the diagnostics in an ad hoc manner.

Update the documentation to note this change and integrate a new test,
gtest_skip_in_environment_setup_test, into the test suite.

This change addresses #2189.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2019-03-30 11:38:03 -07:00
..
advanced.md Handle GTEST_SKIP() when calling Environment::SetUp() 2019-03-30 11:38:03 -07:00
faq.md Update docs, TestCase->TestSuite 2019-01-03 17:18:03 -05:00
Pkgconfig.md Update documentation to syntax highlight code 2018-09-03 21:56:23 +03:00
primer.md Fix grammatical error in primer.md 2019-02-25 08:03:28 -08:00
PumpManual.md Update documentation to syntax highlight code 2018-09-03 21:56:23 +03:00
samples.md Fix doc links 2018-09-04 23:07:18 +03:00
XcodeGuide.md Updated broken and outdated URLs 2018-07-25 19:19:26 +02:00