One use case for gtest_filter and use a naming convention for tests (as you describe in the question).
TEST_F(Foo, SlowRunning_test1) {...} TEST_F(Foo, BugRegression_test1) {...} TEST_F(Foo, SlowRunningBugRegression_test1) {...}
Another way to use separate executables / executables for any type of test. This method has some limitations because gtest uses static auto-registration, so if you include some source file, all tests implemented in this source file will be included in the generated binary / executable file.
In my opinion, the first method is better. In addition, I would perform a new macro registration test to make my life easier:
#define GROUP_TEST_F(GroupName, TestBase, TestName) \ #ifdef NO_GROUP_TESTS \ TEST_F(TestBase, TestName) \ #else \ TEST_F(TestBase, GroupName##_##TestName) \ #endif
source share