Skip to content

FUZZ_TEST_F Should Respect GTEST_SKIP() in GoogleTest Base Fixture #709

Open

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:

#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<SkipFixture> {
 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions