Using test file name in output file names

I use boost::testto run integration tests for a class that creates directories and files. I would like these files to be called specific tests, so if I run into difficulties, I can easily find which test script left its directories / files.

Therefore, I would like to use the name of the test case in the constructor of the device used, as shown below. Is this even possible and how? I was looking for the boost :: test statement, but could not find this information.

eg.

struct foo_fixture
{
    foo_fixture() 
    { 
        std::string case_dependent_name( BOOST_TEST_CASE_NAME ); 
        create_directory( case_dependent_name );
    }
};

BOOST_FIXTURE_TEST_CASE ( foo_case_one, foo_fixture )
{
   ...
}
BOOST_FIXTURE_TEST_CASE ( foo_case_two, foo_fixture )
{
   ...
}
+5
source share
1 answer

I found this and it works:

increase user group discussion

, - , test_unit:

boost::unit_test::framework::current_test_case().p_name
+7

All Articles