When I create a regular TEST (or TEST_F), I can access to the test case information stored in test_info_, like:
TEST_F(MyTestSuite, TestCaseOne)
{
// ...
test_info_->name(); // will return "TestCaseOne"
}
I would like to access this kind of information when I use the parameterized (TEST_P) variant, which allows me to define fixture-based tests.
Looking under the hood, I can see that TEST_P works quite differently than her cousins TESTand TEST_F, as it registers the new test case by calling ::testing::UnitTest::GetInstance()->parameterized_test_registry().GetTestCasePatternHolder<test_case_name>(#test_case_name, __FILE__, __LINE__)->AddTestPattern(...) method. I understand that the class inheriting from TestWithParam will then run all the registered TEST_Ps test cases.
Is there a way to access (either runtime or compile time) to the name (string) of a TEST_P?
Aucun commentaire:
Enregistrer un commentaire