mercredi 11 mars 2015

How to define Boosts tests to run in code?

Using Boost.Test I'm trying to specify the BOOST_TESTS_TO_RUN environment variable in code, so that only some tests will be executed. Using #define BOOST_TESTS_TO_RUN.


The command line parameter --run_tests works fine. But I'd like to do it via the environment variable in order to have a single main.cpp in which I can select different suites and modules.


But I'm not sure on how to specify it, or where. Should it be before including boost? What if I have different cpp files with different test suites?


module_A.cpp



#include "SomeHeader.h"
#define BOOST_TESTS_TO_RUN // ??
#include "boost/test/unit_test.hpp"
BOOST_AUTO_TEST_SUITE( moduleA );
BOOST_AUTO_TEST_CASE( test1 ){}
BOOST_AUTO_TEST_CASE( test2 ){}
BOOST_AUTO_TEST_CASE( test3 ){}
BOOST_AUTO_TEST_SUITE_END();

Aucun commentaire:

Enregistrer un commentaire