Forum Discussion

hellboy1981's avatar
hellboy1981
Regular Visitor
5 years ago

Problem exporting SoapUI reports using Groovy

xxx

 

 

// https://support.smartbear.com/readyapi/apidocs/pro/com/eviware/soapui/reporting/reports/testsuite/WsdlTestSuiteReport.html
def report = new WsdlTestSuiteReport(testSuite)

// https://support.smartbear.com/readyapi/apidocs/pro/com/eviware/soapui/reporting/ReportEngineRegistry.html
def availableReports = ReportEngineRegistry
.getAvailableReports(report) def reportSettings = report
.getModelItemReportParameters() // https://support.smartbear.com/readyapi/apidocs/soapui/com/eviware/soapui/model/TestPropertyHolder.html .getModelItem() // https://www.soapui.org/apidocs/com/eviware/soapui/model/ModelItem.html .getSettings() // https://www.soapui.org/apidocs/com/eviware/soapui/model/settings/Settings.html

// get list of all reports for test case
for (availableReport in availableReports) {
String reportName = availableReport.getName()

log.info("$reportName is available")

if (reportName == "JUnit-Style HTML Report") {
// https://support.smartbear.com/readyapi/apidocs/pro/com/eviware/soapui/reporting/engine/junit/GeneratableJUnitReport.html

def jrFormats = (String[])[ "HTML" ]

// https://support.smartbear.com/readyapi/apidocs/pro/com/eviware/soapui/reporting/GeneratableReport.html#generate-com.eviware.soapui.model.settings.Settings-java.lang.String:A-java.lang.String-
def results = availableReport.generate(
reportSettings,
jrFormats,
dataExportFolder)

availableReport.release()

String path = results[0]

log.info("JUnit created $path")

return path
} else if (availableReport.getName() == "Data Export") {
def jrFormats = (String[])[ "CSV" ]

// https://support.smartbear.com/readyapi/apidocs/pro/com/eviware/soapui/reporting/GeneratableReport.html#generate-com.eviware.soapui.model.settings.Settings-java.lang.String:A-java.lang.String-
def results = availableReport.generate(
reportSettings,
jrFormats,
dataExportFolder)

availableReport.release()

String metricsPath = results[0]

log.info("Data export report has been created at '$metricsPath'")

return metricsPath
}
}

 

In both JUnit and Data Export reprts multiple statistic fields containing wrong zero values.

 

Exporting reports using SOAPUI GUI works properly.

 

Whats wrong with it? Is it settings issue? How can I export SOAP UI report correctly using Groovy?