• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can't generate JUnit report

 
david santana
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Brian Burress
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 754
Eclipse IDE Java
 
david santana
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 754
Eclipse IDE Java
 
david santana
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is how a generate it:




And it works. [=
 
david santana
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone help me with this issue? why can't I generate a report even after doing what Hebert showed?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic