Madhan
Madhan

Reputation: 671

Skip Test Step in SOAPUI through groovy

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

Upvotes: 2

Views: 7149

Answers (2)

user1268477
user1268477

Reputation: 61

If you want to cancel all the test steps then use

testRunner.testCase.testSteps.each{k, v ->    
testRunner.cancel(k)

if want to disable test steps

def testSuite = context.testCase.testSuite;
def totalTestCases = testSuite.getTestCases().size();

for(n in (0..totalTestCases-1))
{    
     testSuite.getTestCaseAt(n).setDisabled(true)
}

Upvotes: 0

dmahapatro
dmahapatro

Reputation: 50275

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.

Upvotes: 2

Related Questions