Forum Discussion

djangofan's avatar
djangofan
Contributor
12 years ago

How do I begin to implement a custom JUnitReportCollector?

Maybe biting off more than I can chew, but I am looking for advice on how to implement the new feature in maven-soapui-extension-plugin for "configuring the JunitReportCollector to be able to modify xml junit files generation" but I am having trouble figuring out where to start.

I basically want a ReportCollector that is capable of printing out the test steps (in the HTML report) as it runs through each test case within a suite. I am not sure this is even possible. I can do this, I just need a basic idea of where to start. I have read all the related threads and help docs on this matter and everything is very vague.

Here is my project template, which is the point I want to start from, in order to implement this:
https://github.com/djangofan/soapui-test

I am guessing this might involve building sub-nodes into the report.xml "testcase" node, like so?


....
<testcase name="RequestTime TestCase" time="0.292">
<teststep name="Step1" time="0.122"/>
<teststep name="Step2">
<failure type="Assertion" message="Test failure.">That statement is not true!</failure>
</teststep>
<teststep name="Step3">
<failure type="Exception">java.lang.NullPointerException</failure>
</teststep>
</testcase>
</testsuite>
</testsuites>


If this is not possible, then the workaround, of course, is to put each of my test steps into it's own test case. This would be perfectly acceptable if I could attach a link to specific console output to each test case.
  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    Hi
    you need to extend the JUnitSecurityReportCollector class. The resulting class can be put in a new jar which will be put in the soapui classpath (when running the GUI, put it in the lib directory)
    in the current topic you will find information about building

    see also this post viewtopic.php?f=5&t=17374 to know how to use your custom collector and also viewtopic.php?f=2&t=17209