Forum Discussion

SKoneru's avatar
SKoneru
Contributor
13 years ago

Custom JunitReports to report each entry in DD as a testcase

HI All,

I looked at the following article to understand how to write a custom report
http://blog.infostretch.com/customizing-soapui-reports
Also there is a plugin to hook the custom JunitReportCollector
https://github.com/redfish4ktc/maven-so ... it-reports

I am writing this custom report to integrate with Jenkins- Junit plugin.

I wrote a custom JunitReportCollector. I noticed that even when there are multiple entries in Data gird(where each entry should be treated as a separate testcase), all the test steps are displayed under one test case name. The testcase count also shows as 1. This is confusing.

I want the test case name to be displayed for each entry in the grid and also the total tests count to be incremented and should be equal to no:of entries in the grid.Is there a data source listener that I need to extend and override?

Any suggestions on how to achieve this will be great. I am stuck at this point.

6 Replies

  • Hi,
    Could we please see the custom JunitReportCollector you created?

    Regards,
    Max
    SmartBear Support
  • Attached is the custom JunitReportCollector java file. I changed the extension to .rtf as the forum didn't allow me to attach a .java extension file.
    What I achieved:-
    1- For each row in the data source, I was able to generate a new testcase entry.
    Note:- There can be nested datasource within a testcase, I identified the actual outer data source loop by appending the test step with name "newtc"
    2- In case of failed testcase, I was able to dump all the test steps
    3- Numbered each test step within a test case.
    4- Attached the generated request/response/status file for each test step.

    Concerns:-
    A- Was not able to display test steps when the test case is "SUCCESS". For this I think the framework should provide an additional API in JunitReport class that takes message.
    Currently we have only report.addTestCase(String name,long time); but there should be an API that takes message and displays, something like report.addTestCase(String name, long time, String message).
    Should I log an enhancement request in the forum?
    B- Wondering if #1 is the right way to display a new test case entry for each row in data source. Is there a better approach?
    C- Any other suggestions will be great
  • Hi,

    I am afraid that scripting and extensions are outside of our scope for support. We will happily take a look at your enhancement request, and will hand it over to the product owner for prioritization.

    Is there anything else we can help you with? If so, let us know and we'll happily assist.

    Regards,
    Arian
    SmartBear Sweden
  • It will be great if I can atleast get some suggestions on how I can improve my code logic for #1
    1- Currently for each row in the data source, I was able to generate a new testcase entry.
    Note:- There can be nested datasource within a testcase, I identified the actual outer data source loop by appending the test step with name "newtc"

    Want to know if there is any better approach like extending some listeners etc?
  • I unfortunately don't have any suggestions - there are no obvious improvements that I can see just by looking at your code. The support doesn't extend to matters regarding scripting and the code base.

    Again, just let me know if there's anything else I can help with.

    Regards,
    Arian
    SmartBear Sweden