boost.test - Can you determine order that Auto Test and Auto Suites will run among several test files?

When using BOOST_AUTO_TEST_SUITE or BOOST_AUTO_TEST_CASE across multiple files, is there a way to guarantee which Test Case or Suite will execute last? In particular, I want the following test to always be executed last. BOOST_AUTO_TEST_CASE(waitForUserToPressEnter) { std::cout << "Press <ENTER> to continue..." << std::endl; std::cin.get(); } I like the post-build event trick to keeping output inside Visual Studio 7, but there will be times that I don't want the tests to all run each time I compile. Thanks, Ed

Ed Johnson wrote:
When using BOOST_AUTO_TEST_SUITE or BOOST_AUTO_TEST_CASE across multiple files, is there a way to guarantee which Test Case or Suite will execute last?
In general you should never write your unit tests to depend on a specific order of execution, but as you're not really writing a test ...
In particular, I want the following test to always be executed last.
BOOST_AUTO_TEST_CASE(waitForUserToPressEnter) { std::cout << "Press <ENTER> to continue..." << std::endl; std::cin.get(); }
I haven't tried this, but what might work is using a global fixture (i.e. BOOST_GLOBAL_FIXTURE) and put the above stuff in its destructor. // Johan

Johan Nilsson wrote:
Ed Johnson wrote:
When using BOOST_AUTO_TEST_SUITE or BOOST_AUTO_TEST_CASE across multiple files, is there a way to guarantee which Test Case or Suite will execute last?
In general you should never write your unit tests to depend on a specific order of execution, but as you're not really writing a test ...
In particular, I want the following test to always be executed last.
BOOST_AUTO_TEST_CASE(waitForUserToPressEnter) { std::cout << "Press <ENTER> to continue..." << std::endl; std::cin.get(); }
I haven't tried this, but what might work is using a global fixture (i.e. BOOST_GLOBAL_FIXTURE) and put the above stuff in its destructor.
// Johan
Thanks, Johan. Unfortunately, Gennadiy let me know that BOOST_GLOBAL_FIXTURE isn't supported in the version of Boost that I am using: 1.33.1

"Ed Johnson"
When using BOOST_AUTO_TEST_SUITE or BOOST_AUTO_TEST_CASE across multiple files, is there a way to guarantee which Test Case or Suite will execute last?
In particular, I want the following test to always be executed last.
BOOST_AUTO_TEST_CASE(waitForUserToPressEnter) { std::cout << "Press <ENTER> to continue..." << std::endl; std::cin.get(); }
Just follow the recommendation in the other post
I like the post-build event trick to keeping output inside Visual Studio 7, but there will be times that I don't want the tests to all run each time I compile.
I a mnot sure how it's related ti the first part of this post, but run by name feature is planned ot be implemented in next release. Gennadiy
participants (3)
-
Ed Johnson
-
Gennadiy Rozental
-
Johan Nilsson