filtering parameterized tests with --gtest_filter

2,179 views
Skip to first unread message

Daniel Mijares

unread,
Dec 2, 2014, 1:15:00 PM12/2/14
to googletes...@googlegroups.com
I'm trying to run a sample parameterized test as per the advanced guide.

It says that

The tests from the instantiation above will have these names:
  • InstantiationName/FooTest.DoesBlah/0 for "meeny"
  • InstantiationName/FooTest.DoesBlah/1 for "miny"
  • InstantiationName/FooTest.DoesBlah/2 for "moe"
  • InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
  • InstantiationName/FooTest.HasBlahBlah/1 for "miny"
  • InstantiationName/FooTest.HasBlahBlah/2 for "moe"

You can use these names in --gtest_filter.


When I compile the snippet and execute with the --gtest_list_tests flag i get

InstantiationName/FooTest.
  DoesBlah/0  # GetParam() = "meeny"
  DoesBlah/1  # GetParam() = "miny"
  DoesBlah/2  # GetParam() = "moe"
  HasBlahBlah/0  # GetParam() = "meeny"
  HasBlahBlah/1  # GetParam() = "miny"
  HasBlahBlah/2  # GetParam() = "moe"

Running with --gtest_list_tests --gtest_filter=*meeny* i don't get any results back.

Running with 
--gtest_list_tests --gtest_filter=*Does* i get

InstantiationName/FooTest.
  DoesBlah/0  # GetParam() = "meeny"
  DoesBlah/1  # GetParam() = "miny"
  DoesBlah/2  # GetParam() = "moe"

and when I run with

--gtest_list_tests --gtest_filter=*0* i get

InstantiationName/FooTest.
  DoesBlah/0  # GetParam() = "meeny"
  HasBlahBlah/0  # GetParam() = "meeny"


Am I doing something wrong? I have a similar use case, and for that as well, I cannot filter on the ValuesIn() strings, only by the numbers of the tests.

 I guess the numbers are fine, but I have strings that I would like to filter by and that would be way better than memorizing or looking up what number that string corresponds to.

Thanks,

Daniel
Reply all
Reply to author
Forward
0 new messages