【发布时间】:2015-01-19 14:57:03
【问题描述】:
我在 Soapui 有一个项目:TestSuite1、TestCase1 和一些 TestStep,如 Groovy 测试、Create Rep 和 Delay
我想要做的是使用 groovy 执行 Create Rep TestStep。 我试过这个:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def testCase = testRunner.testCase;
def testStep = testCase.getTestStepAt(0);
def testStep = testCase.getTestStepByName("Create Rep");
def testStep = testCase.testSteps["Delay"];
testRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null);
testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep);
testStep.run(testRunner, testStepContext);
我得到了这个错误:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script15.groovy: 27:
The current scope already contains a variable of the name testStep @ line 27, column 5.
def testStep = testCase.getTestStepByName("");
^ org.codehaus.groovy.syntax.SyntaxException: The current scope already contains a variable of the name testStep @ line 27, column 5.
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:146)
【问题讨论】: