Calling multiple Fixtures?

Nov 24, 2009 at 6:37 PM

Hi,

I was wondering how I can invoke multiple fixtures before running a test? E.g. I have a fixture to fix the random seed to a particular value and another one to do unrelated setup work.

Is something like 

 

BEGIN_TESTF(DummyTest, RandomFixture)

BEGIN_TESTF(DummyTest, RandomFixture, MiscFixture)

possible or what is the suggested way to implement such behavior?
Thanks a lot!
Philipp

 

Coordinator
Nov 24, 2009 at 6:42 PM

Hi Philipp!

You can only invoke one fixture setup per test, but you can call functions from within a fixture setup function.  The easiest way to do what you are describing is to just make two functions (e.g. FixRandomSeed() and OtherSetup() (or some name for what it actually does, if you want to reuse it)) and then call them both from within the fixture setup function.  You can then use either or both in a different fixture setup function for other tests, if desired.

Maria

Nov 24, 2009 at 7:29 PM

Thanks for the explanation. That makes perfect sense..

Best,

Philipp