#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
// Boost Test declaration and Checking macros
#include <boost/test/unit_test_suite.hpp>
#include <boost/test/test_tools.hpp>
#include <boost/test/floating_point_comparison.hpp>
BOOST_AUTO_TEST_SUITE(my_tests);
BOOST_AUTO_TEST_SUITE();
BOOST_AUTO_TEST_CASE(test_1)
{
}
BOOST_AUTO_TEST_CASE(test_2)
{
}
BOOST_AUTO_TEST_CASE(test_3)
{
}
Now when I run the unit-test all 3 test are executed. But is it possible
somehow to specify that only test 2 should be run?
Run your test executable like this:
test --run_test=test_2
It is in "User's Guide" -> "Runtime configuration" -> "Run by name" in
the documentation.
test --run_test=test_2
Ok so its not possible to define a unit-test "main" function inside the
unit-test where the test to run is specified manually. I am using Visual
Studion and when I press run it automatically runs all the test. As an
alternative I can setup the run command to accept a runtime argument, but
its rather time consuming compared to outcomment a single line or two in the
source file.
Something like this:
Disabling Tests Explicitly in Code
The NCBI extensions include a macro, NCBITEST_DISABLE, to unconditionally
disable a test case or suite. This macro must be placed in the
NCBITEST_INIT_TREE function:
NCBITEST_INIT_TREE()
{
NCBITEST_DISABLE(test_case_name);
NCBITEST_DISABLE(test_suite_name);
}