jeudi 30 juin 2016

Google test: Can I query the name of the test fixture?

I want to use google test to write a class that derives from ::testing::Test and adds functionalities to it using mostly the constructor, or SetUp and TearDown(). Looks like SetUp/TearDown is the way to go so far. My question is:

Let's say we have a small test fixture like this:

TEST_F (PerformanceTest, Inputs)
{
   EXPECT_EQ (0.0, performSaxpy(10, 4.0F, 3.0F, 2.0F));
   EXPECT_EQ (0.0, performSaxpy(1, 5.0F, 4.0F, 3.0F));
   EXPECT_EQ (0.0, performSaxpy(10, 12.0F, 2.0F, 1.0F));
}

What I want to do is, when the SetUp() function is called, I want code inside that to query the name of the test fixture class (PerformanceTest), and the name of the test object (Inputs).

Why do I need to do this? Because I want to write the results of my test fixture to an xml file. For various reasons, I cannot use the default XML output format that google test already provides. However, in google test's default XML output, we get the names of the test fixture class and test object, so hopefully we can do it by custom... Is this possible?

Aucun commentaire:

Enregistrer un commentaire