c++ - GoogleTest Parameterized Test - Possible To Call SetUp And TearDown Between Parameters? -
i have gtest parameterized class call setup , teardown in between each parameter. know googletest offers setup before each test case , setuptestcase before test cases.
i have 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 @ begining of framework , before test cases } static void teardowntestcase() { //called @ end of framework , after test cases } //wishing like: // void setupparameter() { //called before start of parameter } }; instantiate_test_case_p(registrationtest, interfacetest, valuesin(allthevalues::getallmyparams()));
any thoughts on way make work? maybe way see when last test case has been run particular parameter? or have instantiate test case every individual parameter?
i think against practices create such combination, because:
- each test should independent other.
- it looks tests have side effects. experience cause lot of problems later when code grow.
possible solution: - create separated testcases. works. going against framework bad route. if framework change? it possible have align tests...which wrong in production code.