When you run a gtest-based test program with command-line flag --gtest_list_tests, it prints out the names of the test cases and tests within the program instead of running them. Currently the output looks like:
TestCase1.
TestName1
TestName2
TestCase2.
TestName
This is not quite satisfactory for value-parameterized and type-parameterized tests, as their names consist of a base name and an index number, e.g.
TestCaseFoo/5
Here 5 means the test is for the 5th test parameter. Since the actual (type or value) parameter is not printed, there's not enough information for a user to decide which tests to select (if he wants to run them selectively).
One option we discussed and rejected is to make the test parameter part of the test name, as in general the test parameter can contain all sorts of characters that aren't suitable to use in a --gtest_filter flag (and they can be arbitrarily long and awkward to refer to).
I propose to augment the output of -gtest_list_tests with the value of the test parameters (either type parameters or value parameters), e.g.
TestCaseFoo/0. TypeParam=int
TestName1
TestName2
TestCaseFoo/1. TypeParam=float
TestName1
TestName2
This will help the user make an informed decision on which tests to run.
Another option is to keep the existing behavior of --gtest_list_tests and introduce a new flag to trigger this more verbose output. However, that makes the framework more complex to maintain and use, and IMO is not a good long-term plan.
The proposed change could break scripts that parse the output of --gtest_list_tests, but I think it's worth the temporary pain. I will make sure all such scripts used within Google are fixed.
Thoughts? Thanks,
--
Zhanyong