Create a gtest filter without wildcard

Viewed 219

It's possible to create a GoogleTest filter without wildcard in it ?

I have a test suite TestSuiteA

TEST_P(TestSuiteA, Blabla) {
   // ...
}

INSTANTIATE_TEST_CASE_P(Apple, TestSuiteA, testing::Combine(...));

INSTANTIATE_TEST_CASE_P(Ananas, TestSuiteA, testing::Combine(...));

And a second test suite TestSuiteB

TEST_P(TestSuiteB, Kokoko) {
   // ...
}

INSTANTIATE_TEST_CASE_P(Apple, TestSuiteB, testing::Combine(...));

INSTANTIATE_TEST_CASE_P(Ananas, TestSuiteB, testing::Combine(...));

I know precisely which tests I want to launch, so I don't want use the wildcard.

My filter

Apple/TestSuiteA:Apple/TestSuiteB

But it doesn't work -> 0 tests to launch

But with this

Apple/TestSuiteA.*:Apple/TestSuiteB.*

It works

What does this .* mean and why it doesn't work without ?

Thanks

1 Answers

Each tests needs to have a unique name, and you haven't provided the exact correct name. That's why no tests were run. Make sure you know how exactly the tests are named - you can use --gtest_list_tests to list all the test cases defined in a given test executable. Then use the exact names with --gtest_filter separated with :. To read more how to run multiple tests, see gtest advanced documentation.

Related