我试图在SoapUI中使用Groovy从Groovy Script TestStep运行TestCase。
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def testCase = testRunner.testCase;
def testStep = testCase.testSteps["CreateMeeting"];
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);
显示错误:
java.lang.NullPointerException
在行发生错误:
testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep);
项目结构:
答案 0 :(得分:2)
当您调用Groovy测试步骤时,您会获得一些预先声明的变量,例如log
,context
和testRunner
,因此您无需声明自己的变量
这对我有用:
//def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def testCase = testRunner.testCase.testSuite.project.getTestSuiteByName("AddBooking").getTestCaseByName("CreateMeeting")
//def testStep = testCase.testSteps["CreateMeeting"]
//testRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null);
//testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep);
def properties = new com.eviware.soapui.support.types.StringToObjectMap ()
testCase.run(properties, false)