Forum Discussion

pteichner's avatar
pteichner
Occasional Contributor
12 years ago

Junit report from SoapUIProTestCaseRunner

Hi All,

Currently I'm working on a project that will run projects itself (from groovy). The initial run will be using testrunner.bat or sh with the "executer" project.

I'm having trouble with genrating a Junit report.
Empty report
def currentProject = new com.eviware.soapui.impl.wsdl.WsdlProjectPro("$projectFullLocation") 
def projectRunner=new com.eviware.soapui.SoapUIProTestCaseRunner('ProjectRunner')
projectRunner.setIgnoreError(true)
projectRunner.setJUnitReport(true)
projectRunner.setOutputFolder(reportingFolder.toString()+ "/" +currentProject.getName())
projectRunner.runProject(currentProject);
projectRunner.exportReports(currentProject)



Empty report
def currentProject = new com.eviware.soapui.impl.wsdl.WsdlProjectPro("$projectFullLocation") 
def projectRunner=new com.eviware.soapui.SoapUIProTestCaseRunner('ProjectRunner')
def reportCollector = new com.eviware.soapui.report.JUnitReportCollector();
projectRunner.setIgnoreError(true)
projectRunner.setJUnitReport(true)
projectRunner.setOutputFolder(reportingFolder.toString()+ "/" +currentProject.getName())
projectRunner.runProject(currentProject);
projectRunner.exportJUnitReports(reportCollector, reportingFolder.toString()+ "/" + currentProject.getName(), currentProject);


Any help is welcome, cheers.

1 Reply

  • Hi,

    The JUnitReportCollector is a listener object, so needs to be attached to the test cases as they run so that it can gather all of the information it needs.

    Currently you are creating a JUnitReportCollector correctly, but not attaching it to the project so it's not getting chance to gather information. Pretty simple fix, just attach the collector to your project ... something like ...


    def currentProject = new com.eviware.soapui.impl.wsdl.WsdlProjectPro("$projectFullLocation")
    def projectRunner=new com.eviware.soapui.SoapUIProTestCaseRunner('ProjectRunner')
    def reportCollector = new com.eviware.soapui.report.JUnitReportCollector();

    // Attach report collector to project
    currentProject.addProjectRunListener(reportCollector)

    projectRunner.setIgnoreError(true)
    projectRunner.setJUnitReport(true)
    projectRunner.setOutputFolder(reportingFolder.toString()+ "/" +currentProject.getName())
    projectRunner.runProject(currentProject);
    projectRunner.exportJUnitReports(reportCollector, reportingFolder.toString()+ "/"
    + currentProject.getName(), currentProject);


    Hopefully that helps

    All the best!

    <-- awesome, bloke with an afro!!