Skip to main content

Content Starts Here

Configuring ReadyAPI to save Project or TestSuite reports on each test run

This article shows how to configure ReadyAPI to save Project or TestSuite reports on each test run.

If you want to automatically save a Project or TestSuite report to a hard drive for every run triggered either manually or by an automated task, you can achieve this by using the below script. This script can generate a PDF/Excel/CSV type of report with a unique name (the name includes the current timestamp), which allows saving multiple reports to one folder. To perform this, it is necessary to set up a teardown script of the appropriate projects and test suites.

Here is the script:

import java.text.SimpleDateFormat
import com.eviware.soapui.impl.wsdl.WsdlProject
import com.eviware.soapui.reporting.reports.project.WsdlProjectReport
import com.eviware.soapui.reporting.reports.testsuite.WsdlTestSuiteReport
import com.eviware.soapui.reporting.ReportEngineRegistry
import com.eviware.soapui.reporting.GeneratableReport
import com.eviware.soapui.reporting.engine.jasper.JasperReportEngine
import com.eviware.soapui.reporting.ModelItemReport

final String REPORTS_FOLDER = 'C:\\Reports'
final String REPORT_FORMAT = 'PDF' // Please specify CSV to get a .csv file

String getCurrentDateTime() {
    return new SimpleDateFormat('MM-dd-yyyy hh-mm-ss a').format(new Date())

String modifyReportName(String reportFilePath, String reportDisplayName) {
    // Please make any desirable modifications of the report name here
    String newReportName = String.format('%s [%s]', reportDisplayName, getCurrentDateTime())
    // -----
    return FilenameUtils.getFullPath(reportFilePath) + newReportName + '.' + FilenameUtils.getExtension(reportFilePath)

void renameFile(String oldFilePath, String newFilePath) {
    File oldFile = new File(oldFilePath)
    File newFile = new File(newFilePath)

void exportReport(ModelItemReport modelItemReport, String reportDisplayName, String exportFormat,
    String exportDir) {
    JasperReportEngine engine = new JasperReportEngine()
    List<GeneratableReport> reports = new ArrayList<>()
    GeneratableReport[] availableReports = reports.toArray(new GeneratableReport[reports.size()])
    try {
        if (availableReports.length == 0) {
            log.error("Unable to create the \"$reportDisplayName\" report of the \"$exportFormat\" format because there are no available reports.")
        GeneratableReport report = availableReports[0]
        String[] exportFormats = new String[1]
        exportFormats[0] = exportFormat
        String[] exportFileNames = report.generate(modelItemReport.getModelItem().getSettings(), exportFormats, exportDir)
        String reportFilePath = exportFileNames.length > 0 ? exportFileNames[0] : null
        if (StringUtils.isNullOrEmpty(reportFilePath) || !FileUtils.exists(reportFilePath)) {
            log.error("Unable to create the \"$reportDisplayName\" report of the \"$exportFormat\" format. The report file was not created.")
         renameFile(reportFilePath, modifyReportName(reportFilePath, reportDisplayName))
        } finally {
        for (GeneratableReport report : availableReports) {

// For projects
WsdlProjectReport projectReport = new WsdlProjectReport(project)
exportReport(projectReport,, REPORT_FORMAT, REPORTS_FOLDER)

// For test suites
//WsdlTestSuiteReport testSuiteReport = new WsdlTestSuiteReport(testSuite)
//exportReport(testSuiteReport,, REPORT_FORMAT, REPORTS_FOLDER)

Please note - the REPORTS_FOLDER and REPORT_FORMAT variables must be set to the desired values. If you desire to modify the format of the generated report names, you can do it in the "modifyreportname" method.

If you have many projects/test suites to generate the reports, it is recommended to create folders for separate test runs.

Previous MonthNext Month