Today in my post, I will be writing about an easy approach for generating JUnit style HTML reports in soapUI.
Earlier, I did a lot of search in google to find a solution to generate HTML report using soapUI free version as I really wanted to avoid writing JUnit Test case and wanted to see if there is any other appraoch to generate HTML reports :), But couldn't find the required information in one piece. I gathered all the relevant informations from Internet, did some R&D and finally succeeded in generating HTML report in soapUI. Hence I thought of sharing my learning here so that people who are looking out for an easy solution can be benefitted from this post.
To generate JUnit style HTML Test reports you need ANT build tool and soapUI. If you don’t have ANT download it from here..
I have placed ANT directory in 'C' drive i.e. C:\ant. Now add ANT directory to your environment variable so that it can be invoked from any location.
In this approach, I will be using testrunner.bat, This soapUI command line utility will be invoked from the ANT build file and to generate JUnit style HTML reports we will be adding ant junitreport task in the build file. More details on junitreport task can be found here. Our final Build file should look like as shown below.
Note:
Write the above code using any text editor and save the it as build.xml file in your soapUI workspace directory as shown below.
I shall use the same Currency Convertor web service soapUI testing project, for further details please checkout my earlier posts on Establishing DB Connection in soapUI, Steps to parameterize Test Data from DB in soapUI also Groovy Script to store Traffic to a file in soapUI.
Now that we are all set, invoke ANT from command line. To do that, open command line in windows, navigate to your soapUI workspace directory and issue ant command as shown below.
Now that we have completed executing our web service project from ANT, lets us check out the soapUI Test report generated in the HTML folder.
The generated soapUI Test report is as shown below.
I hope this post will be helpful for all soapUI testers who are really keen in generating JUnit Style HTML report just like me..!! :)
Earlier, I did a lot of search in google to find a solution to generate HTML report using soapUI free version as I really wanted to avoid writing JUnit Test case and wanted to see if there is any other appraoch to generate HTML reports :), But couldn't find the required information in one piece. I gathered all the relevant informations from Internet, did some R&D and finally succeeded in generating HTML report in soapUI. Hence I thought of sharing my learning here so that people who are looking out for an easy solution can be benefitted from this post.
To generate JUnit style HTML Test reports you need ANT build tool and soapUI. If you don’t have ANT download it from here..
I have placed ANT directory in 'C' drive i.e. C:\ant. Now add ANT directory to your environment variable so that it can be invoked from any location.
In this approach, I will be using testrunner.bat, This soapUI command line utility will be invoked from the ANT build file and to generate JUnit style HTML reports we will be adding ant junitreport task in the build file. More details on junitreport task can be found here. Our final Build file should look like as shown below.
Note:
- To generate JUnit Style report I am referring to the JUnit stylesheet in the above code which is available in the ANT/ETC directory (styledir="C:/ant/etc").
- If you want to generate JUnit Style HTML reports with Frames, replace ‘noFrames’ with ‘Frames’ in the above code.
Write the above code using any text editor and save the it as build.xml file in your soapUI workspace directory as shown below.
I shall use the same Currency Convertor web service soapUI testing project, for further details please checkout my earlier posts on Establishing DB Connection in soapUI, Steps to parameterize Test Data from DB in soapUI also Groovy Script to store Traffic to a file in soapUI.
Now that we are all set, invoke ANT from command line. To do that, open command line in windows, navigate to your soapUI workspace directory and issue ant command as shown below.
Now that we have completed executing our web service project from ANT, lets us check out the soapUI Test report generated in the HTML folder.
The generated soapUI Test report is as shown below.
I hope this post will be helpful for all soapUI testers who are really keen in generating JUnit Style HTML report just like me..!! :)
Generate JUnit Style HTML Reports in soapUI
Reviewed by Suntaragali The Smart Techie
on
March 10, 2013
Rating:
Very helpful! I was able to generate the JUnit Style html report also. Thanks for the post.
ReplyDeleteYou are welcome..!! :)
DeleteThanks, this is really very helpful. Managed to follow your steps, run my soapUI tests via ant and collect my junit report with ease.
ReplyDeleteYou are welcome Mrosenel..!! :)
DeleteThanks for the post. It is really helpful. We followed the exact steps and the project ran successfully, but we didn't get testsuite status in the report. If you could help us identify what could be the problem, it will be great.
ReplyDeleteSanthi, If you haven't done any changes in the soapUI arugments (build.xml - Line 4)or in the junit stylesheet then you should be able to see the testsuite status, as shown in the above report. If the issue still persists on your side then pls send me the build.xml file
DeleteThanks for your reply, I haven't changed the arg tag in build.xml. Here am pasting my build.xml file, Please find it and help me.
ReplyDelete<project name="Project-Dev" default="testreport" basedir="."> <target name="soapui"> <exec dir="." executable="C:\\Program Files/SmartBear/soapUI-4.5.1/bin/testrunner.bat"> <arg line= "-j -f 'C:/Documents and Settings/shanti/Desktop/New Project Testing Documents/SOAPui/Reports' 'C:/Documents and Settings/shanti/Desktop/New Project Testing Documents/SOAPui/Demo-soapui-project.xml'"/> </exec> </target> <target name = "testreport" depends ="soapui"> <mkdir dir="C:/Documents and Settings/shanti/Desktop/New Project Testing Documents/SOAPui/soapui-test-reports"/> <junitreport todir="C:/Documents and Settings/shanti/Desktop/New Project Testing Documents/SOAPui/Reports"> <fileset dir="C:/Documents and Settings/shanti/Desktop/New Project Testing Documents/SOAPui"> <include name="Demo-soapui-project.xml"/> </fileset> <report todir="C:/Documents and Settings/shanti/Desktop/New Project Testing Documents/SOAPui/Reports" styledir="C:/Ant/apache-ant-1.9.0/etc" format="noframes"> </report> </junitreport> </target> </project>
Hi Suntaragali,
ReplyDeleteI did a mistake in include tag i.e., instead of passing TEST-*.xml I have included the file Demo-soapui-project.xml. Now I am able to run it successfully.
Thank you
Glad to hear that finally you were able to run it successfully Santhi..!! :)
DeleteHi Suntaragali,
ReplyDeleteNeed one more help. How to automate the Google map? What are the prerequisites for it?
Suntaragali,
ReplyDeleteIt very important to automate the Google maps, Please help me out from this!!
Thanks for this great post. I integrated it with Jenkins and it worked perfectly!
ReplyDeleteHi Suntaragali,
ReplyDeleteThanks a lot for your post, it has been very useful for me.
The only issue that I have is that Ant generates an empty JUnit Report for my project.
That's my "build.xml" file:
Any idea?
Thanks in advance,
Victor
Victor,
DeleteI am unable to view your build.xml, can you pls copy paste the contents of your build file.
Meanwhile also pls check for the path of Test-*.xml.
Very helpful, excellent post, thanks.
ReplyDeleteThank you..!!
DeleteHi Suntaragali,
ReplyDeleteAwesome It Just worked Very fine ...
One question I have for you Suntaragali , Have you any time tried with Maven , If So can you please let me know how??
Regards
Anudeep Srivastav
Thanks Anudeep,
DeleteI haven't tried yet but for sure I shall be looking into that and will publish it very soon.
Please do keep visiting this space.
I need to display the Time Stamp in JUNIT Style report
ReplyDeleteIs there any way that the output folder containing reports [HTML in this case as shown above] be dynamically generated date wise every time we run the build xml file through ant. This makes complete automation so that the reports can be tracked easily. Please suggest.
ReplyDeletePlease check out my article on Generate dynamic JUnit Style HTML reports in soapUI
DeleteHi Suntaragali,
Deletevery nice explanation. I tried to do this.. but the report Generating for me is with null values. Even the Test_suite.xml also empty.
Please find build.xml below
Please tell me a way forward.
Many Thanks
Anish Mohan
In case if any of you are having issues in Generating the HTML reports using soapui, I have made a video tutorial on the same. Here is the link: https://youtu.be/RSvq2El4id4
DeleteHope it helps.!!
Hi Suntaragali,
ReplyDeleteI understand your hard work in generating JUnit style with the soapUI's core version. With soapUI PRO, it is a out-of-the box functionality and it is a matter of passing one more parameter to the testrunner command.
Thanks
AJ
How do I get value populated to the fields: Time Stamp, Host and Type. These three fields are blank shown in the JUnit Report.
ReplyDeleteThanks guy,
ReplyDeleteIt very helpful for me in this time. But could you kindly instruct me how to run multi test case. What need to modifie in Build.xml file.
Thanks
Hi Suntaragali,
ReplyDeleteI tried to do this.. but the report Generating for me is with null values. Even the Test_suite.xml also empty.
Find below the build.xml i am using
Thanks,
Nitin
ReplyDeleteNitin
Thank you very much..it is really very helpfull
ReplyDeleteHi,
ReplyDeleteThanks for this post. Its been very helpful.
I have a query and seeking help on the same.
Requirement – To generate html format reports for the soapui automation results obtained. Web services – Restful web services tool used – SoapUI Open Source
Query and help required – Need is to print a property value defined at TestSuite level (of a soapui project) in Junit-style html report. eg., there is a property parameter ‘abc’ at testsuite level. Need is to print ‘abc’ value in html report.
please let me know how a testsuite level parameter value of a soapui project be accessed (without explicity specifying it. Its dynamic value and needs to be accessed) and provided in “junit-frames.xsl” file of Ant.
Basically, i need to edit the “junit-frames.xsl” file and access the soapui projects's testsuite property and make it print in html report. How can this be achieved?
Very useful info.. Thanks Suntaragali !!
ReplyDeleteHi Suntaragali,
ReplyDeleteThanks for this post. You make my day. Do you think it is possible to copy the HTML to the Jenkins build task so you can view the results within Jenkins?
Hi Suntaragali,
ReplyDeleteIt was a good post and is very useful, but here I need one help. Can you please let me know if we can generate the TestSteps data under a TestCase. ie I am looking for individual steps under a TestCase in the report. For now it is just displaying TestCases under a TestSuite.
Thank you
Sireesha
I am getting this error. Please help out!!!
ReplyDelete'ant.bat' is not recognized as an internal or external command,
operable program or batch file.
Build step 'Invoke Ant' marked build as failure
Recording test results
ERROR: Publisher hudson.tasks.junit.JUnitResultArchiver aborted due to exception
hudson.AbortException: No test report files were found. Configuration error?
Thank you for tutorial! It was very useful... and working :)
ReplyDeleteWhere can see the Build.xml file ?
ReplyDeleteHi Suntaragali - Thank you for the post, Build ended with failure and am pasting the build XML file here, please have a look and help me in this regard.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHi I've followed the instructions and am also getting an empty junit report
ReplyDeleteI understand this is to do with the Test-*.xml line in the screenshot above, but don't quite understand what I should put in here?
Hi!!
ReplyDeletecan you please help me this is my build.xml
when i run ant system says build success Total time 0 sec
What should I do when I get this error ?
ReplyDeleteI have also copied the "slf4j-nop-1.7.13.jar" to SoapUI-5.2.1\bin\ext\ still getting the error
[exec] 17:22:14,258 INFO [SoapUI] Adding [C:\Program Files\SmartBear\SoapUI-5.2.1\bin\ext\slf4j-nop-1.7.13.jar] to extensions classpath
[exec] 17:22:17,162 INFO [DefaultSoapUICore] initialized soapui-settings from [C:\Users\DVO05\soapui-settings.xml]
[exec] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[exec] SLF4J: Defaulting to no-operation (NOP) logger implementation
[exec] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[exec] 17:22:54,086 INFO [PluginManager] Adding plugin from [C:\Users\DVO05\.soapuios\plugins\soapui-swagger-plugin-2.2-dist.jar]
[exec] 17:22:54,086 INFO [PluginManager] Adding plugin from [C:\Users\DVO05\.soapuios\plugins\ready-mqtt-plugin-dist.jar]
[exec] 17:23:06,325 ERROR [SoapUI] An error occurred [com.eviware.soapui.plugins.auto.factories.AutoDiscoveryMethodFactory], see error log for details
[exec] java.lang.ClassNotFoundException: com.eviware.soapui.plugins.auto.factories.AutoDiscoveryMethodFactory
[exec] at java.net.URLClassLoader$1.run(Unknown Source)
[exec] at java.net.URLClassLoader$1.run(Unknown Source)
[exec] 17:23:06,400 ERROR [SoapUI] An error occurred [com.eviware.soapui.plugins.auto.factories.AutoImportMethodFactory], see error log for details
[exec] at java.security.AccessController.doPrivileged(Native Method)
Thanx Suntarangali.. It really helped me a lot ... :-)
ReplyDeleteThanx again for ur Post.
ReplyDeleteBut can you plz let us know, how can we configure multiple project.xml files in build.xml
as in CI we usually have multiple projects
Hi
ReplyDeleteThis is my build xml below, i am getting an access denied error on command line when accessing the C:\>soapUIWorkspace>ant
Assistance will be appreciated.Thanks!!
Thanks SUNTARAGALI. By following mentioned steps I am able to generate the HTML reports.
DeleteThanks, blog was really helpful.
My sincere apologies for not responding to your queries. Thanks for all your comments. Please do let me know if you are having any issues with the above solutions... I would be more happy to help you out..!!
ReplyDeleteHi Suntargali, i am getting Empty report in the junit report, and which ant commands we will use in the testrunner.bat file
ReplyDeleteCan you resolve the issue to generae Junit reports , check the below build.xml file...
-----
---
Satish - I am unable to view the build xml file in your comment. Please send it to qaautomationspecialist@gmail.com.
DeleteHey Suntaragali,
ReplyDeleteThanks a ton for this and the other (dynamic report name) post. I probably owe my job to you ;P.
I do not have any SoapUI or ANT or Jenkins experience and have a sudden demo to Board tomm. You save me!! Now I just have one more research - Jenkins Integration and I am good!!!
Thanks a ton again!
Glad to hear that my articles were helpful to you Jigs..!!
DeleteHi,
ReplyDeleteIt was realy wonderful, but here I need one help. Can you please let me know if we can generate the TestSteps data under a TestCase. ie I am looking for individual steps under a TestCase in the report. For now it is just displaying TestCases under a TestSuite.
and also after reports gets generated while viewing junit-noframes.html system not showing the No of test executed and No of testcase fail/pass its allows shown as zero values can u please help me to this.
regards,
Suresh
Hi Suntaragali,
ReplyDeleteI am not able to get the report .
My Build.xml
Please let me know what I am doing wrong
Thanks in anticipation
Aastha
Aastha - Can you please mail me the build.xml file so that I can take a look.
Deletewould you please share your build.xml file?
ReplyDeletecould we generate teststep request and response file using ant and attach to html report?
ReplyDeletecan we also have test steps name in the report ?
ReplyDeleteCan this same xml file used in mac machine ?
ReplyDeleteHi, I tried getting below specified error while executing build.xml file using cmd
ReplyDeleteError:
BUILD FAILED
E:\Demo Framework\Framework Scripts\build.xml:11: Problem: failed to create task or type juintreport
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any / declarations have taken place.
Sorry I typed "I tried". It is "I am"
DeleteHi Suntaragali, This video is really helpful. thanks a lot for detail explanation. I Implemented the same. but, I haven't get any details in Index HTML. columns displayed as shown in video. But no data in it. all the details are zero. how can I get the actual details. am I doing anything wrong. Please suggest.
ReplyDeleteMy build.xml is :
ReplyDeleteTried to copy XML:
Hi,
ReplyDeleteI tried to follow the steps that you mention above and report is generating but report does not contain any details and showing 0 as testcases count but I have one test case instead.
Please find the my build.xml file:
And please let me know where I went wrong.
ReplyDeletehow to add timestamp to test suite in this report
ReplyDeleteI was just browsing through the internet looking for some information and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject. Bookmarked this page, will come back for more. digital pull force gauge
ReplyDeleteIn case if any of you are having issues in Generating the HTML reports using soapui, I have made a video tutorial on the same. Here is the link:
ReplyDeletehttps://youtu.be/RSvq2El4id4
Hope it helps.!!
Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. free tiktok likes, fans, Followers generator
ReplyDeletePlease continue this great work and I look forward to more of your awesome blog posts. href mailto
ReplyDeletehow can this report will be accessed from other systems? how can the report will be viewed by leads?
ReplyDelete