Skip to content

[Bug] SetUpTestSuite might not be called when using RC_GTEST_FIXTURE_PROP #338

@m-pilia

Description

@m-pilia

If a GTest fixture defines SetUpTestSuite or TearDownTestSuite, these are not guaranteed to be called. This will happen for instance if the RapidCheck property is executed before any other GTest test cases in the fixture.

Minimal repro:

class FixtureWithSetUpTestSuite : public ::testing::Test {
protected:
  FixtureWithSetUpTestSuite() {}

  static int static_member;

  static void SetUpTestSuite() { static_member = 1; }
};

int FixtureWithSetUpTestSuite::static_member{};

RC_GTEST_FIXTURE_PROP(FixtureWithSetUpTestSuite, TestSuiteSetup, ()) {
  RC_ASSERT(static_member == 1);
}

This happens because the property is not registered as a test case within the given GTest fixture, but rather RapidCheck generates a separate fixture for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions