• 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

can't generate JUnit report

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
File > Export > General > Ant Buildfiles
 
david santana
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is your eclipse version?
 
david santana
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
If somebody says you look familiar, tell them you are in porn. Or in these tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic