(Note: I'm still using Boost 1.34.1)
Regardless of the AUTO_TEST_CASE function AUTO_TEST_CASE to register your own exception handlers, you need to implement the main init_unit_test_suite function. (You do not need to register any of your autotests there.)
All of my unit test projects use the ut_main.cpp file, which contains (approximately) the following: (This is in addition to all other cpp files containing the actual automatic tests.)
void translate_mfc_exception(CException* pMfcEx) { ... BOOST_ERROR(msg); } // ... using namespace ::boost::unit_test; test_suite* init_unit_test_suite(int argc, char* argv[]) { // Initialize global Handlers: unit_test_monitor. register_exception_translator<CException*>( &translate_mfc_exception ); // Return dummy suite to make framework happy: test_suite* test = BOOST_TEST_SUITE( "Empty Test Suite" ); return test; }
That should be all you need in addition to your autotests.
source share