Groovy 如何在TestCase中取消某些TestStep
我需要根据条件取消TestCase中的特定测试步骤(SoapRequest)。所以我决定创建Groovy脚本Groovy 如何在TestCase中取消某些TestStep,groovy,soapui,Groovy,Soapui,我需要根据条件取消TestCase中的特定测试步骤(SoapRequest)。所以我决定创建Groovy脚本 import com.eviware.soapui.impl.wsdl.teststeps.*; String inMoney = context.expand( '${#Project#Money}' ); def step = testRunner.getTestCase().getTestStepByName("creditMoney"); log.info "step: $
import com.eviware.soapui.impl.wsdl.teststeps.*;
String inMoney = context.expand( '${#Project#Money}' );
def step = testRunner.getTestCase().getTestStepByName("creditMoney");
log.info "step: $step";
if ((inMoney == '0') && (step instanceof WsdlTestRequestStep ) && (step != null))
step.cancel();
但此代码不会取消测试步骤,而是始终返回“false”。
如果这是TestCase中的最后一个测试步骤,我可以调用testRunner.cancel(),它就可以工作了。但就我而言,这不是一个选择。
有人有办法解决这个问题吗?谢谢。要控制测试执行流程,如果需要更复杂的逻辑,可以使用“条件转到”测试步骤(最简单的方法)或“Groovy脚本”测试步骤 详细说明如下: 如果您决定使用groovy脚本,并且不需要取消最后一步,则可以在groovy脚本中按名称运行下一步:
testRunner.runTestStepByName( "next_step_name")
一个简单的谷歌搜索有我这个链接这不适合你吗?