Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I give better names to value-parameterized tests in gtest?

Tags:

googletest

I use value-parameterized tests in gtest. For example, if I write

INSTANTIATE_TEST_CASE_P(InstantiationName,
                    FooTest,
                    ::testing::Values("meeny", "miny", "moe"));

then in the output I see test names such as

InstantiationName/FooTest.DoesBlah/0 for "meeny"
InstantiationName/FooTest.DoesBlah/1 for "miny"
InstantiationName/FooTest.DoesBlah/2 for "moe" 

Is there any way to make these names more meaningful? I'd like to see

InstantiationName/FooTest.DoesBlah/meeny
InstantiationName/FooTest.DoesBlah/miny
InstantiationName/FooTest.DoesBlah/moe
like image 522
Lev Avatar asked Sep 02 '25 13:09

Lev


1 Answers

INSTANTIATE_TEST_CASE_P accepts an optional 4th argument which can be used for this purpose.

See the Advanced GoogleTest Topics or this source code comment for more information on this.

like image 95
ksb Avatar answered Sep 05 '25 17:09

ksb