我有一堆 XML 格式的 SOAP 请求消息。有没有办法将它们导入 SoapUI 项目?
我想导入它们并作为“测试请求”测试步骤添加到现有的测试用例中。
我有一堆 XML 格式的 SOAP 请求消息。有没有办法将它们导入 SoapUI 项目?
我想导入它们并作为“测试请求”测试步骤添加到现有的测试用例中。
一种简单且更自动化的方法是使用 groovy 脚本从您拥有 xml 请求文件的目录中自动创建 testStep 请求:
常规代码执行之前的 SOAPUI 如下所示:
以及必要的常规代码:
import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestRequestStepFactory
import groovy.io.FileType
// get the current testCase to add testSteps later
def tc = testRunner.testCase
// get the testStep as template to create the other requests
def tsTemplate = tc.getTestStepByName("TestRequest template")
// create the factory to create testSteps
def testStepFactory = new WsdlTestRequestStepFactory()
def requestDir = new File("/your_xml_request_directory/")
// for each xml file in the directory
requestDir.eachFileRecurse (FileType.FILES) { file ->
def newTestStepName = file.getName()
// create the config
def testStepConfig = testStepFactory.createConfig( tsTemplate.getOperation(), newTestStepName )
// add the new testStep to current testCase
def newTestStep = tc.insertTestStep( testStepConfig, -1 )
// set the request which just create with the file content
newTestStep.getTestRequest().setRequestContent(file.getText())
}
希望这可以帮助,
Another option is:
或者在请求视图中打开上下文菜单时选择“从...加载”。
将每个请求复制/粘贴到一个新请求中,然后右键单击每个请求并将它们添加到您的测试用例中。