Menu

#10 report start function is called too often

open
nobody
None
5
2012-12-11
2010-01-15
Anonymous
No

The reporter examples in the documentation (text reporter and xml reporter) both call the reporter start function as defined in the reporter->start_suite member much too often when the output is redirected into a file (via shell or fprintf in the reporter code), resulting in the non-wellformed XML depicted below. Output is correct, if there is no redirection/file output. It should also be noted, that the documentation uses "start" and "finish" members for the reporter, which do not exist (I changed them to "start_suite" and "finish_suite", respectively).

The source was compiled on Debian 5.0 x86, gcc 4.3.2

XML output:

<?xml?>
<test name="Top Level">
<test name="A Group">
<?xml?>
<test name="Top Level">
<test name="A Group">
<fail>
<message><![CDATA[A failure]]></message>
<location file="cgreen_test.c" line="8"/>
</fail>
<?xml?>
<test name="Top Level">
<test name="A Group">
</test>
</test>

Textreporter output:

Running "Top Level"...
Running "Top Level"...
Failure!: A Group -> a_test_that_fails -> A failure at [cgreen_test.c] line [8]
Running "Top Level"...
Completed "Top Level": 1 pass, 1 failure, 0 exceptions.

Discussion


Log in to post a comment.