google / google/googletest

Do not run test suite if SetUpTestSuite fails

Open
#3,799 2 comments 1 reaction 1 assignee Claimed by @asoffer View on GitHub
enhancement
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

In the latest 1.11.0 release failed SetUpTestSuite is not ignored anymore, but tests from the suite are still run after it fails.

It is common for tests to rely on something done in SetUpTestSuite, so running tests after it fails causes them to fail anyway or to finish program with segmentation fault. For example:

```
static void SetUpTestSuite() {
...
ASSERT_EQ(SUCCESS_MACRO, someInitFunc()); //fails
m_ptr = malloc(size);
...
}
TEST_F(SomeTestSuite, AfterFailedSetup) {
...
m_ptr[N] = ...; //causes segmentation fault
...
}
```

It would be nice to have an opportunity to mark whole test suite as failed if SetUpTestSuite fails and do not run tests from this suite.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.