How do I disable a Googletest (gtest) parametrized test?
c++, googletest
Solution
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"));
Problem
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")); ```