Ask a Question

SoapUI Jenkins: how to use TestSuiteRunListener

Occasional Contributor

SoapUI Jenkins: how to use TestSuiteRunListener


I have a test pipeline running in Jenkins with a SoapUI node connected to it. I want to run a script (in a test suite, in a testcase) ONE time before I start running my testsuite (I have only one for now). I thought about using the Event TestRunListener.beforeRun, but that will run the script everytime a test case starts. Then I thought about using the  TestSuiteRunListener.beforeRun. But that one gave the following exception:

08:59:45 08:59:45,811 ERROR [EventHandlersRequestFilter] Error in TestSuiteRunListener.beforeRun
08:59:45 08:59:45,817 ERROR [SoapUI] An error occurred [Error in TestSuiteRunListener.beforeRun], see error log for details
08:59:45 08:59:45,818 ERROR [errorlog] Error in TestSuiteRunListener.beforeRun
08:59:45 Error in TestSuiteRunListener.beforeRun
08:59:45 Caused by: groovy.lang.MissingPropertyException: No such property: testCase for class: com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner

Apparently there is something wrong with the following code that I use:

// Check if the test case is run from the command line
if (com.eviware.soapui.SoapUI.isCommandLine()) { "This code is executed by Command Line SoapUI" "Now running setup scripts"
   def testCase = testRunner.testCase.testSuite.project.testSuites['testsuite'].testCases['testcase']
   def testStep = testCase.getTestStepByName("teststep") testRunner, context )

It doesn't recognize testCase for class: com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner used here:

def testCase = testRunner.testCase.testSuite.project.testSuites['testsuite'].testCases['testcase']

So how do I script to have the testRunner run the testcase 'Setup Project' in the testsuite 'tooling-general' using the estSuiteRunListener.beforeRun?

SmartBear Alumni (Retired)

Hi @koen_able,


As far as I can see in our DB, you are currently working with one of our support engineers on this question. It would be great if you could update us on the progress here in the Community.

Thank you in advance!

Olga Terentieva
SmartBear Assistant Community Manager

Occasional Contributor

The following code worked for me with the help of Smartbear and this Smartbear community topic:

import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner
import com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext

def testcase = testRunner.getTestSuite().getProject().getTestSuiteByName("testsuite").getTestCaseByName("testcase") 

if(testcase != null)
	WsdlTestCaseRunner wtcr = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testcase, new 
	testcase.getTestStepByName("teststep").run(wtcr ,wtcr.createContext(null)) 



SmartBear Alumni (Retired)

I'm happy to hear that you've found the solution, @koen_able.

Good luck with your tests!

Tanya Yatskovskaya
SmartBear Community and Education Manager

Showing results for 
Search instead for 
Did you mean: