Reputation: 303
I am using boost test
within a home-grown GUI, and want to access test results (e.g. the failure message and location when a test fails)
The unit_test::test_observer
class provides the virtual method:
void assertion_result(boost::unit_test::assertion_result)
However, unit_test::assertion_result
is just an enum indicating success or failure. From there, I cannot see how to access further information about the test result.
The framework also provides the class test_tools::assertion_result
, which encapsulates an error message, but this only appears to be used for evaluating pre-conditions. (I would have expected this type to be the argument to unit_test::test_observer::assertion_result
).
The log output classes appear to provide more information on test results. These are implemented as streams, which makes it non-trivial to extract test result data.
Does anyone know how I can access the information on test results - success/failure, the test code, the location, etc?
Upvotes: 0
Views: 96
Reputation: 3396
Adding an observer will not give you the level of details you need.
From this class you can add your own formatter using the add_formatter function. This will contain the details of what is happening and where, depending on the formatter log level.
Upvotes: 1