如何在SoapUI中的不同项目之间传输属性

时间:2013-05-20 11:27:06

标签: soapui

我是SoapUi的新手,需要以下方案的帮助:

我有两个项目,每个项目都有与之关联的不同WSDL文件

Project1:
管理
- >登录
- >注销

Project2的:
检索
- >搜索

如何将属性(UserID,AuthToken)从项目1中的登录测试用例中的soap响应传输到Project2中的“搜索”测试用例中的Soap请求?

我尝试过添加测试步骤'Property Transfer'但是只返回Project1下的测试用例列表(例如'Logout')而不是Project2下的测试用例(搜索)?

1 个答案:

答案 0 :(得分:0)

你可以使用groovy脚本测试步骤:

//get test case from other project
project = testRunner.getTestCase().getTestSuite().getProject().getWorkspace().getProjectByName(project_name)
testSuite = project.getTestSuiteByName(suite_name);
testCase = testSuite.getTestCaseByName(testcase_name);

//set properties
testRunner.testCase.setPropertyValue(property_name, property_value);
testRunner.testCase.setPropertyValue(another_property_name, another_property_value);

// run test case
runner = testCase.run(new com.eviware.soapui.support.types.StringToObjectMap(), false);