Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xXnathankerrXx opened this issue Nov 8, 2023 · 0 comments
Open

Comments

@xXnathankerrXx
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant