You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Frot <fr...@lycos.at> on 2003/01/18 23:55:48 UTC

JUNIT & Junitreport - not showing System.out in HTML Report

Hi,

I have a small problem with my on JUnit based testcases.
In my testcases I use System.out.println(..).
Like :

       System.out.println("Test 1 progressing......") ;


I wish to include these in the finally generated JUnit HTML report.
The JUNIT ant task (with printsummary="withOutAndErr") includes the mentioned line :

    [junit] Test 1 progressing......

I have looked at the XML file generated by the junit task, and find the output included :

  <system-out><![CDATA[Test 1 progressing......
  ]]></system-out>

So fas so good.

Now if I look at the generated HTML report does not include these comments as
expected...
Everything else works, except that the System.out's are included in the HTML report.

Now my question ofcourse is why are the messages not included in the HTML report ??
Am I missing something here, is there a option of the junitreport task I forgot ??

Regards, Fred

P.S.: Using ant    : Apache Ant version 1.5 compiled on July 9 2002

P.P.S.: the used tasks are down here :

    <junit printsummary="withOutAndErr" haltonfailure="no" showoutput="on">
      <classpath>
        <pathelement path="${buildJAVA};${JUNITCLASSPATH}" />
      </classpath>
      <formatter type="xml" />
      <batchtest todir="${buildJUNIT}/xml">
        <fileset dir="${buildJAVA}">
          <include name="**/*Test.class" />
          <exclude name="**/AllTests.class" />
        </fileset>
      </batchtest>
    </junit>

    <junitreport todir="${buildJUNIT}">
      <fileset dir="${buildJUNIT}/xml">
        <include name="TEST-*.xml"/>
      </fileset>
      <report format="frames" todir="${buildJUNIT}"/>
    </junitreport>





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JUNIT & Junitreport - not showing System.out in HTML Report

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
On Sunday, January 19, 2003, at 09:58  AM, Erik Hatcher wrote:
> The stylesheet that generates the HTML report simply ignores 
> <system-out> elements.  To have it added, you will have to tweak the 
> XSL.  This can be done easily (if you know a little XSLT) by copying 
> the existing XSL file, making the changes, and pointing to its parent 
> directory using the 'styledir' attribute of the <report> subelement of 
> <junitreport>.

Actually, the junit-frames.xsl does have handling for system-out and 
system-err - it appears it should write them to .txt files and provide 
hyperlinks to them in the HTML view.  I've never seen these links 
appear on reports I've generated though, so perhaps there is a bug in 
the XSL (wrong element path perhaps?).  Anyone seen this work?

	Erik


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JUNIT & Junitreport - not showing System.out in HTML Report

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
On Saturday, January 18, 2003, at 05:55  PM, Frot wrote:
> I have looked at the XML file generated by the junit task, and find 
> the output included :
>
>   <system-out><![CDATA[Test 1 progressing......
>   ]]></system-out>
>
> So fas so good.
>
> Now if I look at the generated HTML report does not include these 
> comments as
> expected...
> Everything else works, except that the System.out's are included in 
> the HTML report.
>
> Now my question ofcourse is why are the messages not included in the 
> HTML report ??
> Am I missing something here, is there a option of the junitreport task 
> I forgot ??
>

The stylesheet that generates the HTML report simply ignores 
<system-out> elements.  To have it added, you will have to tweak the 
XSL.  This can be done easily (if you know a little XSLT) by copying 
the existing XSL file, making the changes, and pointing to its parent 
directory using the 'styledir' attribute of the <report> subelement of 
<junitreport>.

	Erik


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>