Boost logo

Boost Users :

Subject: Re: [Boost-users] Regarding post: Using Boost.Test in Iteration
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2014-02-11 00:49:10


Deepa S <mslvada <at> yahoo.com> writes:

> Yes I would like to know  how I need to write my own main in this case?
>
> Also I was wondering if there is any workaround that was found other than
re-writing the main?
>
> Here is what I am trying to do, may not be the best way, but trying to re-
run the test suite ts1 - 3 consecutive times to test for repeatability:
>
> bool init_unit_test_suite(int argc, char **argv)   
> {
> test_suite* ts1 = BOOST_TEST_SUITE( "SKUResourcesTestSuite" );   
>    ts1->add( BOOST_TEST_CASE(&TestCase1) );       
> ts1->add( BOOST_TEST_CASE(&TestCase2) );
> framework::master_test_suite().add( ts1 );
> for(int i = 0;i < 3;i++) {
> framework::master_test_suite().add( ts1 );
> }
> return true;
> }

There is nothing particularly wrong with this approach. It really depends on
what exactly you want to test.

You can also just make a test case which invokes some other function in a
loop or you can run the test module in a loop from outside.

Gennadiy


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net