GeeCON Prague 2014*
The moose likes Testing and the fly likes can't generate JUnit report Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » Testing
Bookmark "can Watch "can New topic
Author

can't generate JUnit report

david santana
Greenhorn

Joined: Dec 08, 2011
Posts: 10
Hi, this is the test I have:


and this is the build.xml: (I'm very new to JUnit testing so I'm sorry if the code is too long.. I don't know which lines to omit)


why can't I generate a report after running the test (test01) ? I'm running the test using eclipse..
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Usually to generate a JUnit report you need to compile in debug mode
change the <javac srcdir="${src}" destdir="${build}"> to <javac debug="true" debuglevel="vars,lines,source" srcdir="${src}" destdir="${build}">

I discovered when creating/reading this post: Covering your tests with Cobertura, JUnit, HSQLDB, JPA.

If you want, with Eclipse you can generate a build.xml that creates a junit report for you.

Go to export/ant


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Brian Burress
Ranch Hand

Joined: Jun 30, 2003
Posts: 122
david santana wrote:

and this is the build.xml: (I'm very new to JUnit testing so I'm sorry if the code is too long.. I don't know which lines to omit)


why can't I generate a report after running the test (test01) ? I'm running the test using eclipse..


Take a look at your junitreport todir="${junit.output.dir}" and the various todir's of the tests. I have the 'todir' of the test as filset/input to myreporting. I am thinking you want to use '${junit.output.dir}' instead of './results' in your tests.
david santana
Greenhorn

Joined: Dec 08, 2011
Posts: 10
Hebert Coelho wrote:
If you want, with Eclipse you can generate a build.xml that creates a junit report for you.

Go to export/ant


@Hebert: how? can you tell me in detail? I thought the comments in my build.xml says that the build.xml (the one I posted here) is generated by eclipse.. I'll try your suggestions though...

@Brian: I tried your suggestion but the report is still nowhere to be found.. or maybe I'm looking at the wrong place? if I'm not mistaken, ${junit.output.dir} is a variable that stores the path where the junit output will be put, right? how do I know the variable's value?
Brian Burress
Ranch Hand

Joined: Jun 30, 2003
Posts: 122
david santana wrote:

how do I know the variable's value?


The ant script has this line:
<property name="junit.output.dir" value="junit"/>

Your base dir is set up as ".", so I am expecting that the files would be in a junit directory off of whatever directory you are executing the script off of. You may need (or want) to make the directory just to ensure it is there. I haven't tried to see if it will get generated automatically.
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

File > Export > General > Ant Buildfiles
david santana
Greenhorn

Joined: Dec 08, 2011
Posts: 10
Hebert Coelho wrote:File > Export > General > Ant Buildfiles


I tried that but the report is still not there... what do I do?
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

What is your eclipse version?
david santana
Greenhorn

Joined: Dec 08, 2011
Posts: 10
Hebert Coelho wrote:What is your eclipse version?


I'm using eclipse Helios..
Version: Helios Service Release 2
Build id: 20110218-0911
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Here is how a generate it:




And it works. [=
david santana
Greenhorn

Joined: Dec 08, 2011
Posts: 10
@Hebert: I did as your guide showed... the build.xml IS generated but when I run the test, there's no report... how do I generate the report?
david santana
Greenhorn

Joined: Dec 08, 2011
Posts: 10
can anyone help me with this issue? why can't I generate a report even after doing what Hebert showed?
 
GeeCON Prague 2014
 
subject: can't generate JUnit report