Generate JUnit Style HTML Reports in soapUI

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:
  • 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 Generate JUnit Style HTML Reports in soapUI Reviewed by Suntaragali The Smart Techie on March 10, 2013 Rating: 5

72 comments:

  1. Very helpful! I was able to generate the JUnit Style html report also. Thanks for the post.

    ReplyDelete
  2. Thanks, this is really very helpful. Managed to follow your steps, run my soapUI tests via ant and collect my junit report with ease.

    ReplyDelete
  3. Thanks 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.

    ReplyDelete
    Replies
    1. Santhi, 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

      Delete
  4. Thanks 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.

    <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>

    ReplyDelete
  5. Hi Suntaragali,

    I 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

    ReplyDelete
    Replies
    1. Glad to hear that finally you were able to run it successfully Santhi..!! :)

      Delete
  6. Hi Suntaragali,

    Need one more help. How to automate the Google map? What are the prerequisites for it?

    ReplyDelete
  7. Suntaragali,

    It very important to automate the Google maps, Please help me out from this!!

    ReplyDelete
  8. Thanks for this great post. I integrated it with Jenkins and it worked perfectly!

    ReplyDelete
  9. Hi Suntaragali,

    Thanks 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

    ReplyDelete
    Replies
    1. Victor,

      I 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.

      Delete
  10. Very helpful, excellent post, thanks.

    ReplyDelete
  11. Hi Suntaragali,
    Awesome 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

    ReplyDelete
    Replies
    1. Thanks Anudeep,

      I 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.

      Delete
  12. I need to display the Time Stamp in JUNIT Style report

    ReplyDelete
  13. Is 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.

    ReplyDelete
    Replies
    1. Hi Suntaragali,

      very 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

      Delete
    2. 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

      Hope it helps.!!

      Delete
  14. Hi Suntaragali,

    I 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

    ReplyDelete
  15. How do I get value populated to the fields: Time Stamp, Host and Type. These three fields are blank shown in the JUnit Report.

    ReplyDelete
  16. Thanks guy,

    It 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

    ReplyDelete
  17. Hi Suntaragali,


    I 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

    ReplyDelete
  18. Thank you very much..it is really very helpfull

    ReplyDelete
  19. Hi,
    Thanks 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?

    ReplyDelete
  20. Very useful info.. Thanks Suntaragali !!

    ReplyDelete
  21. Hi Suntaragali,

    Thanks 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?

    ReplyDelete
  22. Hi Suntaragali,
    It 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

    ReplyDelete
  23. I am getting this error. Please help out!!!

    '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?

    ReplyDelete
  24. Thank you for tutorial! It was very useful... and working :)

    ReplyDelete
  25. Where can see the Build.xml file ?

    ReplyDelete
  26. Hi 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.

















    ReplyDelete
  27. This comment has been removed by the author.

    ReplyDelete
  28. This comment has been removed by the author.

    ReplyDelete
  29. Hi I've followed the instructions and am also getting an empty junit report
    I 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?

    ReplyDelete
  30. Hi!!

    can you please help me this is my build.xml

















    when i run ant system says build success Total time 0 sec

    ReplyDelete
  31. What should I do when I get this error ?
    I 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)

    ReplyDelete
  32. Thanx Suntarangali.. It really helped me a lot ... :-)

    ReplyDelete
  33. Thanx again for ur Post.
    But 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

    ReplyDelete
  34. Hi

    This 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!!

    ReplyDelete
  35. Replies
    1. Thanks SUNTARAGALI. By following mentioned steps I am able to generate the HTML reports.
      Thanks, blog was really helpful.

      Delete
  36. 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..!!

    ReplyDelete
  37. Hi Suntargali, i am getting Empty report in the junit report, and which ant commands we will use in the testrunner.bat file
    Can you resolve the issue to generae Junit reports , check the below build.xml file...
    -----


















    ---

    ReplyDelete
    Replies
    1. Satish - I am unable to view the build xml file in your comment. Please send it to qaautomationspecialist@gmail.com.

      Delete
  38. Hey Suntaragali,

    Thanks 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!

    ReplyDelete
    Replies
    1. Glad to hear that my articles were helpful to you Jigs..!!

      Delete
  39. Hi,
    It 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

    ReplyDelete
  40. Hi Suntaragali,
    I am not able to get the report .
    My Build.xml




















    Please let me know what I am doing wrong
    Thanks in anticipation
    Aastha

    ReplyDelete
    Replies
    1. Aastha - Can you please mail me the build.xml file so that I can take a look.

      Delete
  41. would you please share your build.xml file?

    ReplyDelete
  42. could we generate teststep request and response file using ant and attach to html report?

    ReplyDelete
  43. can we also have test steps name in the report ?

    ReplyDelete
  44. Can this same xml file used in mac machine ?

    ReplyDelete
  45. Hi, I tried getting below specified error while executing build.xml file using cmd

    Error:
    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.

    ReplyDelete
  46. Hi 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.
    My build.xml is :


















    ReplyDelete
  47. Hi,

    I 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.



    ReplyDelete
  48. how to add timestamp to test suite in this report

    ReplyDelete
  49. I 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

    ReplyDelete
  50. 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

    Hope it helps.!!

    ReplyDelete
  51. 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

    ReplyDelete
  52. Please continue this great work and I look forward to more of your awesome blog posts. href mailto

    ReplyDelete
  53. how can this report will be accessed from other systems? how can the report will be viewed by leads?

    ReplyDelete