Reputation: 101
Is there a way to repeatedly run a unit-test or a set of unit-tests in Boost test?
Let say I have the following:
BOOST_FIXTURE_TEST_SUITE(someSuite, someFixture)
BOOST_AUTO_TEST_CASE(someTest)
{
...
}
BOOST_AUTO_TEST_SUITE_END()
... and I'd like to run someTest
with setup/teardown for let say 100 times.
Upvotes: 10
Views: 2449
Reputation: 405
To execute a specific test multiple times, append a new test case at the end of the desired test's source file with the following content:
BOOST_AUTO_TEST_CASE( TEST_WHICH_REPEATS )
{
for( size_t i = 0; i < 44; i++ )
{
test::YOUR_TARGET_TEST::NAME_OF_THE_TEST_invoker();
}
}
This approach allows you to run the target test 44 times consecutively within a single test case.
Upvotes: 0
Reputation: 163
According to boost config there is no option to specify multiple times execution.
It is possible to use some Linux commands like:
for i in `seq 10`; do command; done
Upvotes: 1
Reputation: 1945
You can always run your test program in a loop. I do not believe there is test case/suite level feature to do this now. Feel free to request one through the ticket.
Upvotes: 1