Reputation: 1
I have three test ,how can I configure to run these test in order of
a.setup()-> a -> a.teardown() ->b.setup()-> b -> b.teardown() ->c.setup()-> c -> c.teardown() ?
Upvotes: 0
Views: 641
Reputation: 696
The order SetUp()
TestBody()
TearDown()
is always given. So your question is, if you can enforce order A,B,C.
First of all, If your tests rely on execution order, something's fishy. A test should always be self-contained.
To answer your question: GTest allows you to shuffle tests using --gtest_shuffle
. This is by default false
, i.e. your test execution order will be deterministic. The order is determined by how the tests are registered, i.e. in which order they are written in the code.
If you have them distributed over multiple files it depends on the compilation order.
Upvotes: 3