SoapUI:使用Property Transfer传输groovy脚本结果

问题描述 投票:0回答:1

我是SoapUI中的绝对菜鸟。我正在寻找答案,但不知何故找不到它。

我处于这样一种情况,我想将两个groovy脚本的结果转移到另一个Groovyscript。不幸的是,在使用Property Transfer时,目标groovy脚本会被源脚本的返回值完全覆盖。我该如何处理?

请在下面找到相同的示例:enter image description here

正如您所看到的,我想将generateCreatedgenerateNonce的转移结果的值传递给generatePasswordtestRunner.testCase.getPropertyValue("Nonce")中的testRunner.testCase.getPropertyValue("Created")脚本但是这似乎对我不起作用。

groovy soapui
1个回答
2
投票

您不需要Property Transfer测试步骤。

您只需让前两个脚本运行 - 就像您现在所做的那样。

然后在你的第三个Groovy脚本中,你只需将结果拉入变量。

这可以使用类似的东西来完成

def result = context.expand( '${Groovy Script#result}' )

在你的情况下,我怀疑你会调整到类似的东西

def created = context.expand( '${generateCreated#result}' )
def nonce = context.expand( '${generateNonce#result}' )

在需要这些变量的情况下在脚本中插入这些行,然后使用变量“created”和“nonce”来保存结果。

© www.soinside.com 2019 - 2024. All rights reserved.