I have a set of typed test cases in google test. However, some of these test cases are simply not applicable for a specific type parameter. Consider this example typed test case:
TYPED_TEST_P(TheTest, ATest){
if(TypeParam::isUnsuitedForThisTest()){
return;
}
// ... real test code goes here
}
This works well, the test is simply skipped. However, when execution the tests, I see a usual
[ RUN ] XYZ/TheTest/0.ATest
[ OK ] XYZ/TheTest/0.ATest (0 ms)
so it is not apparent that the test was skipped, it looks like it simply succeeded. I want to somehow display that the test case was skipped. Is there some kind of method in google test to signal that a test case was skipped. Something like this (this does not exist):
TYPED_TEST_P(TheTest, ATest){
if(TypeParam::isUnsuitedForThisTest()){
SIGNAL_SKIPPED(); // This is what I would like to have
return;
}
// ... real test code goes here
}
Then, the output would change to something like this:
[ RUN ] XYZ/TheTest/0.ATest
[ SKIPPED ] XYZ/TheTest/0.ATest (0 ms)
Is there a feature in gtest that enables such a behaviour?
TypeParam
does not possess. So having a "skip" written in the test result is a lot more meaningful to me than a test that simply does not appear in the test result. – Kingsley