hellboy1981
5 years agoRegular Visitor
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?
- Even with free version, it is possible to generate the test report in Junit style.
With proversion, there are multiple type of reports available out-of-the-box. You don't have to write any script to generate reports.
You may use testrunner.bat(.sh script based on the OS) and pass the appropriate options to generate the report.
Here are the links to documentation if you haven't been thru them
https://support.smartbear.com/readyapi/docs/testing/reports/getting-started.html
https://support.smartbear.com/readyapi/docs/testing/reports/index.html