2013-09-30 87 views
2

我有测试用例从Groovy测试步骤开始,接着是Property和4个SOAP请求测试步骤。在groovy测试步骤中,我执行这些SOAP请求,从属性Test步骤访问数据。通过groovy在SOAPUI中跳过测试步骤

这里我只是想从groovy测试步骤单独执行这些SOAP请求。当我在执行groovy Test步骤后将它作为SOAPUI中的测试用例运行时,这4个SOAP请求也会被执行,并且我的测试用例失败。

我使用testRunner.cancel("Skip the Teststep")它可以跳过这些测试步骤,但它导致执行报告失败,我无法找到任何方法使用groovy跳过测试步骤。

请帮助我这个人。

问候, 马德汉

回答

2

在Groovy脚本一步试试这个。

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

其中step1step2是要跳过的步骤。

0

如果要取消所有的测试步骤,然后用

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

如果要禁用测试步骤

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

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