20

Googletest (GTest) allows you to disable individual tests by adding

DISABLED_

prefix to the test name.

What about parametrized tests -- how do I disable those? Adding the prefix to the test name does not disable them.

For example, how do I disable the example test provided by GTest documentation:

class FooTest : public ::testing::TestWithParam<const char*> {
  // You can implement all the usual fixture class members here.
  // To access the test parameter, call GetParam() from class
  // TestWithParam<T>.
};

TEST_P(FooTest, HasBlahBlah) {
  ...
}

INSTANTIATE_TEST_CASE_P(InstantiationName,
                        FooTest,
                        ::testing::Values("meeny", "miny", "moe"));
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Victor Lyuboslavsky
  • 9,882
  • 25
  • 87
  • 134

1 Answers1

25

You need to add the

DISABLED_

prefix to the instantiation name, like this:

INSTANTIATE_TEST_CASE_P(DISABLED_InstantiationName,
                        FooTest,
                        ::testing::Values("meeny", "miny", "moe"));
Victor Lyuboslavsky
  • 9,882
  • 25
  • 87
  • 134