在SoapUi中,如何通过groovy脚本创建Soap Request?

时间:2019-03-20 17:00:30

标签: soap groovy request soapui

当我通过命令行运行该代码时,未创建最后一步。如何创建一个Soap请求?

import com.eviware.soapui.impl.wsdl.*  
import com.eviware.soapui.impl.WsdlInterfaceFactory
import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestRequestStepFactory
import com.eviware.soapui.impl.wsdl.teststeps.registry.GroovyScriptStepFactory

String projectName = "Teste";
String projectPath = "C:/XX/";
String fullProjectPath = "$projectPath$projectName" + ".xml";
String pathToWSDL = "MY_WSDL?wsdl";

def currentProject = testRunner.testCase.testSuite.project;

WsdlProject project = new WsdlProject();
project.setName(projectName);

WsdlInterface iface = WsdlInterfaceFactory.importWsdl(project,pathToWSDL, true)[0]
context.testCase.testSuite.project.save("");

project.addNewTestSuite('Teste');
project.getTestSuiteByName('Teste').addNewTestCase('Teste');


project.getTestSuiteByName('Teste').getTestCaseByName('Teste').addTestStep(GroovyScriptStepFactory.GROOVY_TYPE, "GroovyScript")
project.getTestSuiteByName('Teste').getTestCaseByName('Teste').addTestStep(WsdlTestRequestStepFactory.REQUEST_TYPE, "SOAP")

如果我在命令行中运行,则会得到以下信息: Command-line

如果我通过SoapUi运行,则会弹出2个弹出窗口: Pop Up1 Pop Up2 我都单击确定后,我得到了我想要的东西: SOAPUI

0 个答案:

没有答案