• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question about JUnitReport task

 
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to create a report after a junit test is completed.

When I tried to use the JUnitReport task, it is not creating the desired xml that can be use to show the results in a frame format.

I know we need xalan to get JUnit task going. Do I need any thing else so that a meaningful(frames) report is generated??
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you post the <target>'s you're using to 1) run the tests and 2) generate the report?
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it looks like this:

<project name="junittest" default="test" basedir=".">
<target name="test">
<junit printsummary="true" haltonfailure="true">
<formatter type="brief" usefile="true" />
<formatter type="xml" />
<test name="cingcom.estorepost.test.TestXstreamTest" />
</junit>
<junitreport todir="./reports">
<fileset dir="./reports">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="./reports/html"/>
</junitreport>
</target>
</project>

Also in the ant javadocs it says something like:
"If you want to use Xalan 1.2.2, the noframes report is still supposed to work. If you want the frames support, copy the file junit-frames-xalan1.xsl from the Ant distribution's etc directory to a new directory, change its name to junit-frames.xsl and use the task's styledir attribute to point to it. You will also need a compatible (older) version of Xerces. as well as BSF(bsf.jar). Again, using Xalan 2 is simpler and supported."

The javadoc prescribes to go the route of noframes, which kind of defeates the purpose of creating a decent test report

BTW i am using jdk1.3.1, if that makes any sense.
[ August 23, 2004: Message edited by: Kishore Dandu ]
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At least you have a problem where the <junit> task generates test results (TEST-*.xml) into the current directory but you're telling <junitreport> to look for them in a directory named reports.
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the correction.

It works nice and generates a no frames html(when report format selection is noframes).

But if I have report format changed to frames, the output is not very user friendly. Any ideas??

I get the following exception during the frames report generation.

[junitreport] jar:file:/C:/ant/apache-ant-1.6.2/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl; Line 107; Column 81; javax.xml.transform.TransformerException: java.lang.ClassNotFoundException: redirect
[ August 23, 2004: Message edited by: Kishore Dandu ]
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got everything figureout by adding styledir attribute to the report task.
 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check this link

http://java2simple.blog-city.com/read/831662.htm
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
check this:
Ant 1.6.2 <junitreport> doesn't work on Java 1.4.1
http://twasink.net/blog/archives/2004/07/ant_162_junitre.html

In a summary, you should at least use JDK 1.4.2

or:
"When the Xalan.jar was copied to j2sdk1.4.1_01\jre\lib\endorsed and the ant script was run the problem went away."
 
reply
    Bookmark Topic Watch Topic
  • New Topic