No Boost Test Results

I am trying to implement unit test using test libraries. I started by reading the manual on the acceleration site. After that, I make a simple test program in one of my existing projects. The only problem I am facing is that I cannot see the test result. I am sure that I am doing something wrong :), but I can not understand it. Below are the details of my project

I use visual studio8 for this: I have a solution called MyProject.sln

Along with other projects, I have a project called MyDLL.vcproj (the type of this project is DLL )

Along with other files in MYDLL proj, I add a new cpp file name MyTest.cpp , the file contains the following code:

#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
//#define BOOST_TEST_MODULE MyTestTestModue  //no need for this maro if above macro is used
#include <boost/test/unit_test.hpp>

BOOST_AUTO_TEST_CASE(SampleTC)
{
    BOOST_CHECK(true);
};    

I make the following changes to the MYDLL project properties file

C++ -> General -> Additional Include Dependencies = D:\MyProject\Boost\boost\test
Linker -> General -> Additional Libray Directories = D:\MyProject\Boost\lib\win32\Debug
Linker -> System -> SubSystem = (/SUBSYSTEM:CONSOLE)

I read all the compilation data given in the manual, but still can not get the result. Ideally, I want to use the Boost test as a standalone lib (dynamic library varian UTF).

+3
source share
2 answers

I'm sure I'm doing something wrong :)

In fact, I think the problem is that you are doing something right.

, true, Boost.Test . , : --log_level=all BOOST_TEST_LOG_LEVEL all.

. .

: --log_level ( )

+2

; EXE ( ).

, - - Boost unit-test logger :

boost::unit_test::unit_test_log_t::instance().set_threshold_level( boost::unit_test::log_messages );

, :

 #define MY_BOOST_TEST_MESSAGE( msg ) BOOST_TEST_MESSAGE( `__FILE__` << `__LINE__` << " " << msg )
+1

Source: https://habr.com/ru/post/1789667/


All Articles