XML output from Test library

I am using the CVS head of Boost.Test up to date this morning and producing the log output in XML format. I find that the resulting file is not not well-formed XML according to Firefox and Saxon. There are two issues: there are angle brackets in the attribute values and a single file contains two node trees. The first issue is indirectly caused by using the BOOST_FUNC_TEMPLATE_TEST_CASE macro. The log output then becomes: <TestLog><TestSuite name="Shared/Pulse"><TestCase name="ShortPulses<Imaging::AirSamplePeakFind_c>">... Where "ShortPulses" is the templated test function and "Imaging::AirSamplePeakFind_c" is the name of the type. The angle brackets in attribute valule is not allowed. The second issue is that the output stream contains the <TestLog> node tree which is then followed by the <TestResult> tree so the XML document has two top level nodes. Previously the TestLog output used to go to stdout and TestResult went to stderr (I believe), meaning that I could capture them to different files, or redirect the TestLog ouptut and leave TestResult on the terminal if I wanted to. I'm not sure what the solution is if it's preferred not to send TestResult to stderr. Perhaps the XML document needs a higher level node such as <Boost.Test> that contains <TestLog> and <TestResult>. I notice also that the XML stream is all on one line, wc under cygwin reports zero lines and a line length of 38438 in my case. This is perfectly readable by browsers and Saxon however not by standard text editors. Would it be possible to put some line breaks in so that the file could be more easily viewed in text editors? For reference I am running my test program as:
./TestPulse.exe --log_level=ALL --output_format=XML > TestResult.xml Using cygwin under Windows. The test harness is compiled using Borland BCB6.
Richard

You (Richard.Jennings@teraview.com) wrote: RJ> I notice also that the XML stream is all on one line, wc under cygwin RJ> reports zero lines and a line length of 38438 in my case. This is RJ> perfectly readable by browsers and Saxon however not by standard text RJ> editors. Would it be possible to put some line breaks in so that the RJ> file could be more easily viewed in text editors? Just pipe it to the 'xmllint -format'. Seems to be easiest solution and universal one. -- Mikhail Gusarov ICQ UIN: 111575219 JID: dottedmag@jabber.ru

"Richard Jennings" <Richard.Jennings@teraview.com> wrote in message news:1CFE360F7FED6D46A110BEF31F2F54FE029FD0@JUPITER.Teraview.local...
I am using the CVS head of Boost.Test up to date this morning and producing the log output in XML format. I find that the resulting file is not not well-formed XML according to Firefox and Saxon.
There are two issues: there are angle brackets in the attribute values and a single file contains two node trees.
The first issue is indirectly caused by using the BOOST_FUNC_TEMPLATE_TEST_CASE macro. The log output then becomes: <TestLog><TestSuite name="Shared/Pulse"><TestCase name="ShortPulses<Imaging::AirSamplePeakFind_c>">...
The second issue is that the output stream contains the <TestLog> node tree which is then followed by the <TestResult> tree so the XML document has two top level nodes. Previously the TestLog output used to go to stdout and TestResult went to stderr (I believe), meaning that I could capture them to different files, or redirect the TestLog ouptut and leave TestResult on the terminal if I wanted to. I'm not sure what the solution is if it's preferred not to send TestResult to stderr. Perhaps the XML document needs a higher level node such as <Boost.Test> that contains <TestLog> and <TestResult>.
Thanks for the report all points are true. Test results should go into sterr by default and '>' isn't allowed. I couldn't make both log and result to go under the same hood, since they produces by two independent agents
I notice also that the XML stream is all on one line, wc under cygwin reports zero lines and a line length of 38438 in my case. This is perfectly readable by browsers and Saxon however not by standard text editors. Would it be possible to put some line breaks in so that the file could be more easily viewed in text editors?
For this release I dropped an attempts to pretty print an XML output. In most cases is auto-processed anyway. And one could use numerous formatting utilities if need to. Gennadiy.
participants (3)
-
Gennadiy Rozental
-
Mikhail Gusarov
-
Richard Jennings