#5008 closed Bugs (fixed)
Boost.Test does not do checkpointing of entry/exit of test cases
Reported by: | Owned by: | Gennadiy Rozental | |
---|---|---|---|
Milestone: | Boost 1.59.0 | Component: | test |
Version: | Boost 1.40.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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).
It appears that Boost.Test does not consider the entry point of the unit test function as a checkpoint, while the documentation says it does[1]. I can 'fix' this by inserting check/pass points at the beginning of every function, but shouldn't Boost.Test do this automatically ?
Test case:
struct A {};
BOOST_FIXTURE_TEST_SUITE( TestSuite, A ) BOOST_AUTO_TEST_CASE(testThrow) {
throw A();
} BOOST_AUTO_TEST_SUITE_END()
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 solution is to instrument the Boost.Test macros to include the checkpoints.
[1] 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."
Attachments (1)
Change History (5)
by , 12 years ago
Attachment: | boost-checkpoint-test_method.patch added |
---|
comment:1 by , 12 years ago
The attachment adds the checkpointing before the fixture is is created, before the test is run, after the test is run (ie before the fixture is destructed). I believe this only fixes AUTO* test cases, not the 'regular C++' style testcases.
Patch is against Boost 1.40.
comment:2 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 by , 7 years ago
Milestone: | To Be Determined → Boost 1.59.0 |
---|
patch to boost.test for checkpointing in AUTO test-cases