google / google/fuzztest

FUZZ_TEST_F Should Respect GTEST_SKIP() in GoogleTest Base Fixture

Open
#709 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.1k
Forks
137
Avg merge
3d 6h
Merged PRs (30d)
22

Description

GoogleTest allows calling GTEST_SKIP() in the SetUp() method of a fixture to skip all tests that use that fixture: https://google.github.io/googletest/advanced.html#skipping-test-execution.

FUZZ_TEST_F on the other hand continues to run the test. The test output is also confusing in this scenario. The logs and command line output indicate the test failed, but the status of each test appears to be skipped.

Minimal Example:
```cpp
#include "testing/base/public/gunit.h"
#include "testing/fuzzing/fuzztest.h"
#include "third_party/googlefuzztest/googletest_fixture_adapter.h"

namespace {

class SkipFixture : public testing::Test {
protected:
void SetUp() override { GTEST_SKIP(); }
};

class FuzzTestFixture
: public ::fuzztest::PerFuzzTestFixtureAdapter {
public:
void FailingTest() { FAIL(); /*Not Skipped*/ }

void FailingTestIsSkipped() {
GTEST_SKIP();
FAIL(); /*Skipped*/
}
};

TEST_F(SkipFixture, FailingTestIsSkipped) { FAIL(); /*Skipped*/ }

FUZZ_TEST_F(FuzzTestFixture, FailingTest); // Test Fails!
FUZZ_TEST_F(FuzzTestFixture, FailingTestIsSkipped);

} // namespace
```

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.