jeudi 9 avril 2015

GoogleTest Parameterized Test - Possible To Call SetUp And TearDown Between Parameters?

I have a gtest parameterized class that I would like to call some SetUp and TearDown in between each parameter. I know googletest offers SetUp which is before each test case and SetUpTestCase() before ALL test cases.


I have something like this:



class MyParameterizedTest: public TestWithParam<MyParams>
{
public:
MyParameterizedTest() {}

void SetUp()
{
//called before every test case
}

void TearDown()
{
//called after every test case
}

static void SetUpTestCase()
{
//called at the begining of framework and before all test cases
}

static void TearDownTestCase()
{
//called at the end of the framework and after all test cases
}

//Wishing for something like:
// void SetUpParameter()
{
//called before start of parameter
}
};

INSTANTIATE_TEST_CASE_P(RegistrationTest, InterfaceTest, ValuesIn(AllTheValues::GetAllMyParams()));


Any thoughts on a way make this work? Maybe a way to see when the last test case has been run for a particular parameter? Or will I have to instantiate a test case for every individual parameter?


Aucun commentaire:

Enregistrer un commentaire