简体   繁体   English

使用“启动测试运行器”从常规脚本保存全局属性时,未添加全局属性

[英]Global property is not getting added when saving it from groovy script using “launch test runner”

  1. Step 1 : I have a soap rest project, In that i am getting a userID from response. 步骤1:我有一个soap rest项目,因为我从响应中获取了一个userID。
  2. Step 2 : When i run the test case separately to get the userID, the groovy script for setting the user ID in global property is working fine. 步骤2:当我分别运行测试用例以获取用户ID时,用于在global属性中设置用户ID的常规脚本运行良好。
    Refer : com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils.globalProperties.setPropertyValue('userID', 'ID from response') 请参阅: com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils.globalProperties.setPropertyValue('userID', 'ID from response')
  3. Step 3 : But when i run my whole project using "launch test runner" to get the userID from response and setting the userID to a global property as defined in the above example is not working. 第3步:但是当我使用“启动测试运行程序”运行我的整个项目以从响应中获取用户ID并将用户ID设置为上述示例中定义的全局属性时,此方法不起作用。

Does any one have idea on this? 有人对此有想法吗?

Thanks in advance for the answer. 预先感谢您的回答。

Here is the groovy script which can set the global property value. 这是可以设置全局属性值的常规脚本。

Groovy Script Groovy脚本

def newValue = 'testsetvalue'
//set the value to global property called PROPERTY_NAME
com.eviware.soapui.SoapUI.globalProperties.setPropertyValue('PROPERTY_NAME', newValue)
// get the property value which was set above.
def getNewValue = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue('PROPERTY_NAME')
//assert it
assert getNewValue == newValue

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM