How to export statistics from SoapUI load test via groovy script?

31 views Asked by At

I have a working project with load test.

def loadTest = testRunner.testCase.testSuite.project.getTestSuiteByName("Load").getTestCaseByName(testCaseSelect).getLoadTestByName(loadTestSelect)

loadTest.run().waitUntilFinished()

I need to export statistics from this place: soapUiScreenShoot

I tried

def testResults = loadTest.getStatistics()
testResults.exportToCsv("C:/Users/tester/Desktop/statistics.csv")

but I'm receiving an error:

groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.loadtest.WsdlLoadTest.getStatistics() is applicable for argument types: () values: [] Possible solutions: getStatisticsModel() error at line: 92

I asked ChatGPT but any solutions didn't work (maybe my prompts were incorrect :))

1

There are 1 answers

1
tim_yates On BEST ANSWER

Or, maybe ChatGPT is garbage

From looking at the Javadoc here and here, have you tried

def testResults = loadTest.getStatisticsModel()
new ExportStatisticsAction(testResults).exportToFile(new File("C:/Users/tester/Desktop/statistics.csv"))

Not tested it, but it's from actual help docs, not imagined by a statistical model of words