|
Boost Users : |
From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2005-08-19 19:25:34
Hi, Kim
Thanks for the report.
> The format of the XML output changed quite a bit between 1.32 and
> 1.33. Ok, I can deal with that; in fact, the new format is quite a
> bit easier to deal with, and I've already finished with the changes.
> It would be nice if this format were documented though.
I will try to document is ASAP. It may happend we will have 1.33.1. I will
try to do it by that time.
> Unfortunately, there is one change that I haven't been able to figure
> out a good way to deal with. If a test case aborts, due to an
> exception uncaught by the test itself, the exception is caught by the
> unit test framework. The occurrence of the abort is recorded in the
> test results. In 1.32, this would be reported by including an
> <aborted ...> subentry for the test case data, including some
> descriptive text.
> In 1.33, the descriptive text is printed to std::cerr
I think you are mistaken. Log entries by default should appear in std::cout.
> and the report indicates that the test case was aborted via
> the "result" value for the test case. The generated report no longer
> contains the descriptive text. (I don't care all that much about this
> last change.)
Error description is a part of the log.
> The problem is the printing of the descriptive text for the exception
> to std::cerr. That is also the stream to which the test report is
> written, and I'm capturing the report information by redirecting
> stderr to a file when invoking a test program. The exception text
> ends up appearing at the beginning of the report file, and isn't
> valid XML, which causes my report parser to die. (If necessary, I may
> end up prefixing the parser with a step to skip over anything that
> doesn't look like XML, but that's pretty ugly.)
I don't see how it could be possible. Are you sure you redirect only stderr
into your file.
> Now, I never really liked redirecting stderr to a file in order to
> capture the report. What if something in the test program were to
> write to stderr? (Which is exactly what is happening now.) I see that
> there is now (in 1.33) a mechanism for setting the stream used by the
> report generator (boost:unit_test::results_reporter::set_stream()).
> But after spending the last couple of days pouring over the
> documentation and sources for Boost.Test, I have no idea where I
> would put a call to that function that doesn't involve patching the
> Boost.Test sources. There doesn't seem to be a place to insert such
> user code, at least not that I can find. Have I overlooked something,
> or is this really a hole in the present design / implementation?
There several thing you could do:
1. Check your redirection. Log should appear in std::cout. While report
should appear in std::cerr
2. You could set a --log_level=nothing (witch is a good idea for automated
test runners anyway) and no log entries will appear
3. You could redirect log and/or report streams. Put configure testcase as a
first one in a module:
BOOST_AUTO_TEST_CASE( configure )
{
boost::unit_test::results_reporter::set_stream( report );
boost::unit_test::unit_test_log::set_stream( log );
}
Regards,
Gennadiy
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