aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Could not create JUNIT HTML reports? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Could not create JUNIT HTML reports?" Watch "Could not create JUNIT HTML reports?" New topic
Author

Could not create JUNIT HTML reports?

Micky Morgan
Greenhorn

Joined: Sep 20, 2006
Posts: 19
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
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31079
    
163

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Micky Morgan
Greenhorn

Joined: Sep 20, 2006
Posts: 19
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"/>
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
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

Joined: Sep 20, 2006
Posts: 19
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
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Could not create JUNIT HTML reports?