Skip Test Step in SOAPUI through groovy

groovysoapui

I have Test case starts with Groovy Test step and followed with Property and 4 SOAP request test steps. In groovy Test step I performing execution of those SOAP requests, accessing data from property Test step.

Here I just want to execute those SOAP request from groovy test step alone. When I ran it as Test Case in SOAPUI after Executing groovy Test step, those 4 SOAP requests also get executed and my Test case got failed.

I use testRunner.cancel("Skip the Teststep") it could skip those test step, But it results as failure in Execution report and I cant find any method to skip test step using groovy.

Please help me somebody on this.

Regards,
Madhan

Best Answer

Try this in the Groovy Script step.

testRunner.testCase.testSteps.each{k, v ->  
    if(k in ['step1', 'step2']) 
        v.cancel()
}

where step1 and step2 are the steps you want to skip.