繁体   English   中英

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

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

  1. 步骤1:我有一个soap rest项目,因为我从响应中获取了一个userID。
  2. 步骤2:当我分别运行测试用例以获取用户ID时,用于在global属性中设置用户ID的常规脚本运行良好。
    请参阅: com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils.globalProperties.setPropertyValue('userID', 'ID from response')
  3. 第3步:但是当我使用“启动测试运行程序”运行我的整个项目以从响应中获取用户ID并将用户ID设置为上述示例中定义的全局属性时,此方法不起作用。

有人对此有想法吗?

预先感谢您的回答。

这是可以设置全局属性值的常规脚本。

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