Create Reports using JUnit:
After running test scripts in eclipse it would be good if we generate reports. Junit is one the most popular unit testing framework around.
Below are the steps to generate reports:
1. Right click on project and click on "Export" option
2. Expand "General" node and select "Ant Buildfiles", click on "Next" button
3. Select the project (let all default options),
Junit output Directory ... F:\Automation\First\junit
click on "Finish" button
4. build.xml file should be created under project folder
5. Now we need to add junit jar and Tools.jar file in Ant's "Global Entires"
6. Select "Window" menu, click on "Preferences"
7. In "Preferences" window, expand "Ant" root node, click on "Runtime"
8. Click on "Classpath" tab, expand "Global Entires"
9. Click on "Add External JARs" button
10. Navigate to your "eclipse" directory (where eclipse is installed). Select "plugins ->org.junit_3.8.2.v3_8_2_v20100427-1100" directory. Select junit.jar file. and add Tools.jar which is located under java/JDK/Lib
11. Now right click on build.xml file and select Run As -> Ant Build.."
12. In "Edit Configuration and launch" window, select "build", "tootltip (the script we want to run)" and "junitreprot" checkboxes and click on "Run" button
13. All your test scripts will run and finally report will be generated under the same project directory under "junit" folder. To view JUint folder please refresh.
14. Click on "index.html", you will see the report
Hope you all enjoy this post.
After running test scripts in eclipse it would be good if we generate reports. Junit is one the most popular unit testing framework around.
Below are the steps to generate reports:
1. Right click on project and click on "Export" option
2. Expand "General" node and select "Ant Buildfiles", click on "Next" button
3. Select the project (let all default options),
Junit output Directory ... F:\Automation\First\junit
click on "Finish" button
4. build.xml file should be created under project folder
5. Now we need to add junit jar and Tools.jar file in Ant's "Global Entires"
6. Select "Window" menu, click on "Preferences"
7. In "Preferences" window, expand "Ant" root node, click on "Runtime"
8. Click on "Classpath" tab, expand "Global Entires"
9. Click on "Add External JARs" button
10. Navigate to your "eclipse" directory (where eclipse is installed). Select "plugins ->org.junit_3.8.2.v3_8_2_v20100427-1100" directory. Select junit.jar file. and add Tools.jar which is located under java/JDK/Lib
11. Now right click on build.xml file and select Run As -> Ant Build.."
12. In "Edit Configuration and launch" window, select "build", "tootltip (the script we want to run)" and "junitreprot" checkboxes and click on "Run" button
13. All your test scripts will run and finally report will be generated under the same project directory under "junit" folder. To view JUint folder please refresh.
14. Click on "index.html", you will see the report
Hope you all enjoy this post.
I am gettind the below error after following ur step 11
ReplyDeletePlease help me out!
Buildfile: E:\Eclipse_workspace\testViewer\build.xml
build-subprojects:
init:
build-project:
[echo] testViewer: E:\Eclipse_workspace\testViewer\build.xml
[javac] E:\Eclipse_workspace\testViewer\build.xml:42: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
BUILD FAILED
E:\Eclipse_workspace\testViewer\build.xml:42: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files\Java\jre6"
Total time: 390 milliseconds
Hi Vijay,
ReplyDeleteItclearly showing that thare is some error in your Java_home :\Program Files\Java\jre6"
U r Java_home shoudl point to :\Program Files\Java\JDK"
please change u rJAVA_HOME PATH..
if u have any problem pls send mail to nagaselenium@gmail.com
Thanks,
Naga
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHi Naga,
ReplyDeleteI am using Selenium RC with Junit and reporting the results as u have guided...
I want to do two things:
1. Assertion, on failing this step the test excution stops > This is possible using assert* commands
2.Verfication, on pass/fail it has to be logged and test execution should continue further
3. I want to take screenshots of failures...
> Please let me know how can we do this
Thanks,
Vijay
thanks for your post!!
ReplyDeleteHi,
ReplyDeleteI need the same behavior in TestNG. Is't possible to do,if yes please share it.
12. In "Edit Configuration and launch" window, select "build", "tootltip (the script we want to run)" and "junitreprot" checkboxes and click on "Run" button
ReplyDeletetool tip and junitreport options are not available. Can you pls help me on this.
And also when i run the script - > runas--java application
Hi Sruthi,
ReplyDeleteHere tooltip means the script name.
Send me your script so that i can help you..click contat me link there and send u r code..
Thanks,
Naga
Hi, I get error during execution:
ReplyDeleteBuildfile: E:\eclipse\WebDriver\build.xml
build-subprojects:
init:
build-project:
[echo] WebDriver: E:\eclipse\WebDriver\build.xml
[javac] E:\eclipse\WebDriver\build.xml:43: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
build:
Sector:
[mkdir] Created dir: E:\eclipse\WebDriver\junit
[junit] Running Sector
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit] Test Sector FAILED
junitreport:
[junitreport] Processing E:\eclipse\WebDriver\junit\TESTS-TestSuites.xml to E:\DOCUME~1\CONSUL~1\LOCALS~1\Temp\null255203125
[junitreport] Loading stylesheet jar:file:/E:/eclipse/plugins/org.apache.ant_1.8.2.v20120109-1030/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] : Error! The first argument to the non-static Java function 'replace' is not a valid object reference.
[junitreport] : Error! Cannot convert data-type 'void' to 'reference'.
[junitreport] : Fatal Error! Could not compile stylesheet
[junitreport] Failed to process E:\eclipse\WebDriver\junit\TESTS-TestSuites.xml
BUILD FAILED
E:\eclipse\WebDriver\build.xml:135: Errors while applying transformations: Fatal error during transformation
Total time: 4 seconds
i am following this procedure but index.html file is not generated...
ReplyDeleteHi,
ReplyDeleteI am following all steps finally i got the report,the report was generated in xml format.How to generate a report as a html format
getting this very same error as sum1 wrote above.. what to do now??
ReplyDeleteBUILD FAILED
E:\eclipse\WebDriver\build.xml:135: Errors while applying transformations: Fatal error during transformation
[junitreport] Processing D:\MonkeyTestingWS1\android-test\junit\TESTS-TestSuites.xml to C:\Users\MANISH~1.SIN\AppData\Local\Temp\null742538617
ReplyDelete[junitreport] Loading stylesheet jar:file:/D:/eclipse/plugins/org.apache.ant_1.8.2.v20120109-1030/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] : Error! The first argument to the non-static Java function 'replace' is not a valid object reference.
[junitreport] : Error! Cannot convert data-type 'void' to 'reference'.
[junitreport] : Fatal Error! Could not compile stylesheet
[junitreport] Failed to process D:\MonkeyTestingWS1\android-test\junit\TESTS-TestSuites.xml
Hi, I get error during execution:
ReplyDeleteBuildfile: E:\eclipse\WebDriver\build.xml
build-subprojects:
init:
build-project:
[echo] WebDriver: E:\eclipse\WebDriver\build.xml
[javac] E:\eclipse\WebDriver\build.xml:43: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
build:
Sector:
[mkdir] Created dir: E:\eclipse\WebDriver\junit
[junit] Running Sector
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit] Test Sector FAILED
junitreport:
[junitreport] Processing E:\eclipse\WebDriver\junit\TESTS-TestSuites.xml to E:\DOCUME~1\CONSUL~1\LOCALS~1\Temp\null255203125
[junitreport] Loading stylesheet jar:file:/E:/eclipse/plugins/org.apache.ant_1.8.2.v20120109-1030/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] : Error! The first argument to the non-static Java function 'replace' is not a valid object reference.
[junitreport] : Error! Cannot convert data-type 'void' to 'reference'.
[junitreport] : Fatal Error! Could not compile stylesheet
[junitreport] Failed to process E:\eclipse\WebDriver\junit\TESTS-TestSuites.xml
BUILD FAILED
E:\eclipse\WebDriver\build.xml:135: Errors while applying transformations: Fatal error during transformation
Total time: 4 seconds
This comment has been removed by the author.
DeleteI'll right away grab your rss as I can not find your email subscription hyperlink or e-newsletter service. Do you'νe any?
ReplyDeletePlease alloω me recognise in orԁеr that I may ѕubscribe.
Thanks.
Here іs my ѕite - pointsforfree.wordpress.com
Few comprehend the ramifications of site redesign on
ReplyDeleteranking. Press Release - You may ask your public
relation company to write press release for you. Each google search has its own algorithms which can
be rules that figure out how websites are placed
in their search results rank.
Here is my homepage ultimate demon review
A gold plated Swiss watch can market for over $4,000.
ReplyDeleteA Will this be a close look for everyday use or possibly for
special occasions. As we've got outlined, seeking the perfect men's luxury watch can be described as a tricky and frequently
times expensive proposition in the event you don't take the necessary steps.
Also visit my weblog :: Watches-bestprice.com
I have tested this out and they are also excellent to prevent Acne killer
ReplyDeleterecurrences. Along with asthma, camphor oil can be used freely on other parts of body.
A feature of the monster midweek gamble on Benitez to lose his job was the number of volunteers, it may
ReplyDeletehave an how to get rid of acne ridden face.
The three of us chuckled at Dillard's remark, and strolled out to the family of this child. A relaxed ecstatic state can remain a long time after the orgasm. Do this nightly for the best face moisturizer for how to get rid of acne prone skin. He gets a good laugh.
i have follow your step but index.html file not generated only xml file generated in junit folder so what to do for that
ReplyDeleteBy Following U r Steps ,
ReplyDeleteIt creates Report in XML rather than HTML
PLS provide steps to create report in HTML
Im getting this error java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main : Unsupported major.minor version 52.0
ReplyDeleteThanks for the Information. It worked well for me but my question: i have more than 50 test cases, do i need to check in the 'Edit Configuration and launch' window before running the test and how can i run the test suite with that and see all in the report if i didnt check the boxes for all the test cases
ReplyDelete2018425 leilei3915
ReplyDeletecoach outlet
fitflop sale
ray ban sunglasses wholesale
canada goose
gucci outlet
fitflops sale clearance
cheap ray ban
michael kors outlet clearance
pandora charms
adidas superstar
Red Bottom for Women
ReplyDeletePandora Jewelry Official Site
Kyrie Shoes
Jordan Retro 11
Nike Air Max 270
Jordan 4 Retro
Pandora
Jordans 11
Jordan 11
Pandora Jewelry
Rodney20181014
Retro Jordan 11
ReplyDeletePandora Jewelry Official Site
Pandora Jewelry Outlet
Jordan 11 For Sale
Jordan 9
Pandora Jewelry Official Site
Nike 270
Jordan 4
Yeezy boost 350 v2
Kyrie Shoes
Rodney20181017
I am really admired for the great info is visible in this blog that to lot of benefits for visiting the nice info in this website.
ReplyDeleteThanks a lot for using the nice info is visible in this blog.
Selenium Online Training
I found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing.. Believe me I did wrote an post about tutorials for beginners with reference of your blog.
ReplyDeleteSelenium online training
Really nice post. Provided a helpful information. I hope that you will post more updates like this
ReplyDeleteAWS Online Training
AWS Certification
AI Training
Nice post. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated posts…
ReplyDeleteTableau online training
Thanks for Posting such an useful and nice stuff...
ReplyDeleteSelenium Testing Tutorial for Beginner
Selenium Tutorial for beginners Step by Step
Selenium Tutorial Videos
jordan shoes
ReplyDeletegolden goose outlet
goyard tote
golden goose
moncler outlet
supreme new york
michael kors outlet store
kobe byrant shoes
coach outlet online
air jordan