I am using Boost.Test Unit Test Framework for native C++ projects. All is working fine, but I've got one issue after upgrading to Visual Studio 2010: The messages about failed tests are no more shown in the error list after the tests ran as a post build step. This is a pity since the combination of Boost.Test with native C++ project came closest (although still beeing far away) to the comfort I am used to from unit testing managed projects. I am using the configuration recommended by the authors of Boost.Test here. Can anyone help with this minor but a bit comfort lessening issue?
Regards,
Paul
If you don't want to wait for a release and want to fix the formatter by yourself
open
BOOST_PATH\boost\test\impl\compiler_log_formatter.ipp
change (line 163 in boost_1_46_1)
output << "error in \"" << test_phase_identifier() << "\": ";
to
output << "error : in \"" << test_phase_identifier() << "\": ";
and recompile boost with bjam again.
cd BOOST_PATH
bjam.exe
Visual Studio 2005 Build output for compiler errors looks like this:
|.\ut_TEMPLATE.cpp(8) : error C2065: 'x' : undeclared identifier
Whereas Visual Studio 2010 compiler errors look like this in the output window:
|1>ut_TEMPLATE.cpp(8): error C2065: 'x' : undeclared identifier
(Edit: See the comment by gbjbaanb about the >1
.)
Now, crosschecking what BOOST_ERROR outputs (you can use a simple printf to reproduce if you have your exe in the post build step):
VS 2005:
|./ut_TEMPLATE.cpp(8): error in "test_TEST": check true == false failed [1 != 0]
VS 2010:
|1> ut_TEMPLATE.cpp(10): error in "test_TEST": check true == false failed [true != false]
Slight difference, but not too much and testing further with a manual printf:
printf("ut_TEMPLATE.cpp(00): error : in \"test_TEST\": check true == false failed [true != false]" "\n");
^^^ .. Note colon here
We also get VS 2010 to recognize this output as error:
BOOST_AUTO_TEST_CASE(test_TEST)
{
printf("ut_TEMPLATE.cpp(00): error : in \"test_TEST\": check true == false failed [true != false]" "\n");
BOOST_CHECK_EQUAL( true, false);
}
1>------ Build started: Project: ut_TEMPLATE, Configuration: Release Win32 ------
1> ut_TEMPLATE.cpp
1> ut_TEMPLATE.vcxproj -> ....\UnitTests\ut_TEMPLATE\..\..\..\Release\ut_TEMPLATE.exe
1> Running 1 test case...
1>ut_TEMPLATE.cpp : error : in "test_TEST": check true == false failed [true != false]
1> ut_TEMPLATE.cpp(9): error in "test_TEST": check true == false failed [true != false]
1>C:\Programme\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command ""....\\ut_TEMPLATE.exe" --result_code=no --report_level=no
1>C:\Programme\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code -1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
So it would appear you/we/Boost.Test needs to tweak it's output so that the VS2010 IDE still recognizes the error message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With