Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Test] does not always include checkpoint information
From: Peter Soetens (peter.soetens_at_[hidden])
Date: 2010-12-02 17:27:30


On Thu, Dec 2, 2010 at 8:34 PM, Gennadiy Rozental <rogeeff_at_[hidden]> wrote:
> Peter Soetens <peter.soetens <at> gmail.com> writes:
>
>>
>> I'm using boost 1.40. When parsing the output of a Boost.Test xml file, I
>> sometimes get this error:
>>
>> "test-result.xml:cvc-complex-type.2.4.b: The content of element 'Exception'
is
>> not complete. One of '{LastCheckpoint}' is expected." (output from Hudson
Test
>> plugin).
>
> Can't really comment on this output. This is something generated by your
tool.
> Can you should the Boost.Test xml?

The output is:
./testboost --log_level=all --report_level=detailed --output_format=xml
<TestLog><TestSuite name="Master Test Suite"><TestSuite
name="TestSuite"><TestCase name="testThrow"><Exception>unknown
type</Exception><TestingTime>0</TestingTime></TestCase></TestSuite></TestSuite></TestLog><TestResult><TestSuite
name="Master Test Suite" result="failed" assertions_passed="0"
assertions_failed="1" expected_failures="0" test_cases_passed="0"
test_cases_failed="1" test_cases_skipped="0"
test_cases_aborted="1"><TestSuite name="TestSuite" result="failed"
assertions_passed="0" assertions_failed="1" expected_failures="0"
test_cases_passed="0" test_cases_failed="1" test_cases_skipped="0"
test_cases_aborted="1"><TestCase name="testThrow" result="aborted"
assertions_passed="0" assertions_failed="1"
expected_failures="0"></TestCase></TestSuite></TestSuite></TestResult>

The code is :

struct A {};

BOOST_FIXTURE_TEST_SUITE( TestSuite, A )
BOOST_AUTO_TEST_CASE(testThrow)
{
    throw A();
}
BOOST_AUTO_TEST_SUITE_END()

>
>> It appears that It does not consider the entry point of the unit test
function
>> as a checkpoint, while the documentation says it does.
>
> I do not believe so. Can you point me to the relevant page?

>From : http://www.boost.org/doc/libs/1_45_0/libs/test/doc/html/utf/user-
guide/test-output/test-log.html

"In most cases The UTF can't provide an exact location, where system
error occurs or uncaught C++ exception is thrown from. To be able to
pinpoint it as close as possible the UTF keeps track of checkpoints -
the location a test module passed through. ***A test case entrance and
exit points, a test tool invocation point the UTF tracks
automatically***. Any other checkpoints should be entered by you
manually. The test log provides two macros for this purpose:
BOOST_TEST_CHECKPOINT - to specify a "named" checkpoint and
BOOST_TEST_PASSPOINT - to specify an "unnamed" checkpoint."

*** emphasis mine. So I would expect that it appears as a checkpoint
in the XML output, with the line number pointing at declaration of the
test name.

>
>> I can 'fix' this by
>> inserting check/pass points at the beginning of every function, but
shouldn't
>> Boost.Test do this automatically ?
>
> Test log output reports test case enter/exit events, thus you should be able
to
> figure this out already.

I don't get any line number when it's not explicitly present as a
checkpoint xml tag for example. The xml data is read by an external
tool, that then tries to relate the errors to files and linenumbers.
As you can see from the XML output above. No filename nor linenumber
is listed, although something definately went wrong. A
'LastCheckPoint' tag would provide that information.

Could I add a checkpoint in all my fixtures in order to 'inject' an
initial checkpoint in each test ?

Peter


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net