How to generate test reports using Junit+selenium+Eclipse

6,618 views
Skip to first unread message

racheal john

unread,
Aug 31, 2010, 7:24:16 AM8/31/10
to seleniu...@googlegroups.com
Hi,

I would like to know how to generate the test reports using junit+eclipse+selenium.
I m using java as the language.
When i refered the previous posts, i gt some idea. but still gt lots of doubts.
I installed ant and had set the correct path for jdk and ant.But still i m getting an error:
Unable to locate tools.jar.Expected to find the it C:\Java\jre\lib\tools.jar
Build file:build.xml does not exist

I googled n found many has got the same error. 
When i tried to do it with eclipse.. i m not quite sure where shud i put ma build.xml.

It would be great if some one could have given me the steps to generate test reports in eclipse +junit.
Waiting for the solution.

Thanks


jrock2004

unread,
Aug 31, 2010, 9:53:52 AM8/31/10
to Selenium Users
surefire-reports would be a good way with TestNG

gopi k

unread,
Aug 31, 2010, 12:32:12 PM8/31/10
to seleniu...@googlegroups.com
its very simple to create junit reports using eclipse

follow these steps and it worked for me

1) First generate an Ant build file for your project.
In the Export page select "Ant Buildfiles" it is under General. Then select a
project that contains your JUnit tests. The default JUnit output directory is
appropriately named "junit".
2) Next resolve dependencies by making sure that the junit.jar is added to Ant's
"Global Entries."
Window->Preferences->Ant->Runtime->Global Entries and Add External JARs...
Navigate to your "eclipse" directory (where eclipse is installed). It is under
"plugins" directory and presently the junit.jar is in a directory named
"org.junit_3.8.1". If this is missing then you will see error messages since
junit is an optional Ant task.
3) Run then right click on the Ant build file (by default build.xml) and Run
As->Ant Build... This will display a list of targets. All of the launch
configurations you have previously configured will have a corresponding target
in your Ant build file. Select the desired target(s), and also select the
"junitreport" target. Check the "Target execution order" text area to make sure
the junitreport is run last.

Whenever you run a test case it will generate results and will be placed in the
junit output directory. These results are formatted into an HTML report by the
junitreport target and stored in the junit output directory. This is a quick and
dirty explanation of the process, but hopefully it helps get you off your feet.



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


Vasavi Kaza

unread,
Aug 31, 2010, 2:02:17 PM8/31/10
to seleniu...@googlegroups.com
Hey Gopi,

This looks easy.  I am giving it a try. Looking for something similar since a while.

Thanks,
Vasavi

Sats

unread,
Sep 6, 2010, 12:15:45 PM9/6/10
to Selenium Users
Hi Gopi...

I am looking for some kind of help in creating the html reports of
Junit tests in Eclipse.
Hope your post would give a good start...
I will try it out and let u know asap...
Can you give me an email on satd...@gmail.com
> > selenium-user...@googlegroups.com<selenium-users%2Bunsu...@googlegroups.com>
> > .

Shaba K

unread,
Sep 6, 2010, 12:58:27 PM9/6/10
to seleniu...@googlegroups.com
That was a neat explanation.
 
-Shaba

To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

Shaba K

unread,
Sep 7, 2010, 6:26:54 AM9/7/10
to seleniu...@googlegroups.com
Hi Gopi & others who ever have tried out the steps mentioned.
 
I wasn't able to see the html report though i clearly mentioned
 
<property name="junit.output.dir" value="C:\junit"/>

<target name="FnGUITestCase">

<mkdir dir="${junit.output.dir}"/>

<junit fork="yes" printsummary="withOutAndErr">

<formatter type="xml"/>

<test name="org.est.junittestcases.FnGUITestCase" todir="${junit.output.dir}"/>

<classpath refid="Selenium.classpath"/>

</junit>

</target>

 

Any thoughts ???

farheen khan

unread,
Sep 7, 2010, 6:36:36 AM9/7/10
to seleniu...@googlegroups.com
<target name="FnGUITestCase"> this is the class name.
<test name="org.est.junittestcases.FnGUITestCase> this should be replaced with your test case name.
and then, double click on build-project  and junit-report in ant...
 U can find the report in junit folder of you project workspace.
--
Thanks,
farheen

racheal john

unread,
Sep 9, 2010, 4:30:02 AM9/9/10
to seleniu...@googlegroups.com
Hi,

I tried out all the steps that gopi gave.
But when i compile the build.xml it says:

BUILD SUCCESSFUL
Total time: 1 second

I could not find any Junit report.
I dont have any folder which says Junit.
Got a pck SimpleJunitTests and  under that ,i have  src which contains a Math and under Test i have TestMath.java

then the build.xml

Please help me..
I m confused.

Hero

unread,
Sep 16, 2010, 4:39:31 AM9/16/10
to Selenium Users
Hi I had posted step by step generation of JUnit HTML report in this
blog

http://kirankanumuri.blogspot.com/2010/09/generating-junit-html-reports-using.html

Regards,
Kiran

rahul

unread,
Mar 7, 2011, 9:28:00 AM3/7/11
to seleniu...@googlegroups.com
Please help me for creating reports.. I am trying for long time but still not able to generate reports.
Please if possible send me a small program with ant file. Thanks in advance,

Regards
Rahul

stardust

unread,
Mar 7, 2011, 12:11:04 PM3/7/11
to Selenium Users
it is very easy:

1. run your tests in eclipse
2. in the junit window, click "Test run history..." > "Export".

done

R!dhdh! patel

unread,
Mar 7, 2011, 3:48:42 PM3/7/11
to seleniu...@googlegroups.com
Hi Rahul,

here all steps:

1. if you are using eclipse, create folder junit
2. create ant build file ...go to file --> export --> general --> ant build files -->select project ( and make sure junit output directory : listed junit folder )
3. Now, add junit.jar to   Window->Preferences->Ant->Runtime->Global Entries and Add External JARs...select    eclipse-java-helios-SR2-win32\eclipse\plugins\org.junit_4.8.1.v4_8_1_v20100427-1100\junit.jar and if it gives tools.jar error add tools.jar from your jdk framework.

4. now right click on build.xml go to run as- external tools confirgurations ---targets tab and select your test suites and junitreport.

5. then right click on build.xml and run as antbuild file...

6. you will get report created under junit folder.


Thanks,
Ridhdhi
http://automationusingopensource.blogspot.com/2011/02/generating-test-result-report-using-ant.html


--

rahul

unread,
Mar 9, 2011, 3:12:30 AM3/9/11
to seleniu...@googlegroups.com
Thanks a lot  :) Now i am able to generate reports

srinu vasu

unread,
Mar 9, 2011, 6:37:30 AM3/9/11
to seleniu...@googlegroups.com
Hi, I am using testNG for report.I am able to generate report but the
thing is am not able to the see the tets cases are in sequential
order.Could any one tell me solution for this???

Thanks,
Srinivas

On 3/9/11, rahul <rahulmend...@gmail.com> wrote:
> Thanks a lot :) Now i am able to generate reports
>

Deepa Kiran Bagepalli

unread,
Mar 9, 2011, 7:32:24 AM3/9/11
to seleniu...@googlegroups.com, srinu vasu

srinu vasu

unread,
Mar 9, 2011, 8:46:10 AM3/9/11
to Deepa Kiran Bagepalli, seleniu...@googlegroups.com
Hi Deepa,

I have created as per the thread but eventhough i am not getting my
test cases in sequence order.see my screenshot.

untitled.JPG
Reply all
Reply to author
Forward
0 new messages