Forum Discussion

koen_able's avatar
koen_able
Occasional Contributor
6 years ago

SoapUI Jenkins: how to use TestSuiteRunListener

Hi, 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 o...
  • koen_able's avatar
    6 years ago

    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.support.types.StringToObjectMap
    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 com.eviware.soapui.support.types.StringToObjectMap()) 
    	testcase.getTestStepByName("teststep").run(wtcr ,wtcr.createContext(null)) 
    
    }