How to transfer properties between different projects in SoapUI

允我心安 提交于 2019-12-30 07:48:16

问题


I am new to SoapUi and need some help with following scenario:

I have two project, each has different WSDL file associated with it

Project1:
Administration
->Login
->Logout

Project2:
Retrieval
->Search

How do I transfer properties (UserID, AuthToken) from soap response in Login testcase from project 1 to Soap request in 'Search' testcase in Project2?

I have tried by adding test step 'Property Transfer' but that only return list of testcases under Project1 (e.g. 'Logout') but not the testcase under Project2 (Search)?


回答1:


You can do it using groovy script test step:

//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);


来源:https://stackoverflow.com/questions/16648474/how-to-transfer-properties-between-different-projects-in-soapui

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!