• 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

Could not create JUNIT HTML reports?

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For some reason, My ant task is not creating JUNIT's HTML reports? Here are the details..

1) It creates C:\reports directory. It contains some html files including index.html. if I open this HTML file,. it shows zero tests as below. But actually it runs 2 tests successfully. Could you see any problem?

Tests Failures Errors Success rate Time

0 0 0 NaN 0.000


It also creates TESTS-TestSuites.xml. But this xml file is emty

I am using JUNIT 4.1, Ant 1.7 Beta and Java 1.5

Here is the snippet of my ant build script. Note that on my command window, I could see that "OK (2 tests)"...but why it is not writing this to HTML report. When I open the

My Ant Task:
============
------------------------------------
<target name="report" depends="run">
<junitreport todir="./reports">
<fileset dir="reports">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="./reports"/>
</junitreport>
</target>
-----------------------------------------


Command promt details:
=====================

C:\>ant -f build.xml run
Buildfile: build.xml

init:

compile:
[javac] Compiling 1 source file to C:\java\source\test\java

update:
[jar] Building jar: C:\java\java-client-driver-tests.
jar

run:
[java] JUnit version 4.1
[java] ..
[java] Time: 12.86

[java] OK (2 tests)


report:
[junitreport] Processing C:\reports\TESTS-TestSuites.xml to C:\DOCUM
E~1\micky\LOCALS~1\Temp\null82112573
[junitreport] Loading stylesheet jar:file:/C:/ant1.7.0/lib/ant-junit.jar!/org/ap
ache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] Transform time: 1281ms
[junitreport] Deleting: C:\DOCUME~1\micky\LOCALS~1\Temp\null82112573


BUILD SUCCESSFUL
Total time: 23 seconds
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Micky,
The xml file gets generated during the call to <junit>. So unless you are looking at the wrong file/directory, there is nothing you could be doing wrong in your code.

Since this is Ant 1.7 beta and this functionality has changed since 1.6, I recommend reporting it as a potential bug to the Ant team.
 
Micky Morgan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne,

I have chnaged back to Ant 1.6.5, Still unsuccessful. Do you think that JUNIT tester has some suites and some tetsts are added to the suite? Note that I have don't have any suite ..All my tests are individual and run as

<target name="run" depends="prev_target">
<java classname="org.junit.runner.JUnitCore" fork="yes" >
<arg value="com.thoughtworks.selenium.QATester"/>
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne's response above and the ant manual on JunitReport task indicate that the xml files are generated by the junit task (that you aren't using). So, there aren't any tests to report on in your case.

JUnitReport
Merge the individual XML files generated by the JUnit task and eventually apply a stylesheet on the resulting merged document to provide a browsable report of the testcases results.


[ September 26, 2006: Message edited by: Carol Enderlin ]
 
Micky Morgan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure, My reports folder do contain TESTS-TestSuites.xml file created by JUNIT. The contenst of this file is:

<?xml version="1.0" encoding="UTF-8" ?>
<testsuites></testsuites>

 
Carol Enderlin
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, but I'm just saying if you don't use the junit task I don't see how you'll get the results you want with junitreport. It may be possible (I don't know), but I don't see anyone jumping in to help with that, although that might get more traction in the testing forum. In this forum, we'd probably be inclined to give an ant-related answer.

I found a tutorial that uses junit + junitreport.
[ September 29, 2006: Message edited by: Carol Enderlin ]
 
Shiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic