Search code examples
unit-testingboostboost-test

No Output from Boost Test


I am trying to implement unit test with boost test libraries. I started by reading the manual at the boost site. After this i make a simple test program in one of my already existing project. The only problem which i face is that i am unable to see the test result. I am sure that i am making some thing wrong :) but i am unable to figure that. Following are the details of my project

I am using visual studio8 for this: I have a solution named MyProject.sln

Along with other projects i have a project named 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 following changes in MYDLL project property sheet

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 details given in the manual, but still unable to get the output. Ideally i want to use the Boost test as a standalone lib (Dynamic library varian of UTF).


Solution

  • I am sure that i am making some thing wrong :)

    Actually, I think the problem is you are making something right.

    Your test passes, because the value checked is true, and by default Boost.Test only outputs information about tests that have failed. You need to set the log level, which can be done one of two ways: passing --log_level=all as an option the the test executable, or setting the environment variable BOOST_TEST_LOG_LEVEL to all.

    See this page of the documentation for all the run time parameters.

    Edit: It's actually --log_level (with an underscore in the middle)