【问题标题】:SoapUI: Transfer groovy script results using Property TransferSoapUI:使用属性传输传输 groovy 脚本结果
【发布时间】:2019-03-11 16:53:38
【问题描述】:

我是 SoapUI 的绝对菜鸟。我正在寻找这个问题的答案,但不知何故真的找不到它。

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

请在下面找到相同的示例:

如您所见,我想将generateCreatedgenerateNonce 的传输结果的值传递给testRunner.testCase.getPropertyValue("Nonce")testRunner.testCase.getPropertyValue("Created") 中的generatePassword 脚本 但这似乎对我不起作用。

【问题讨论】:

    标签: groovy soapui


    【解决方案1】:

    您不需要为此进行属性转移测试步骤。

    您只需让前两个脚本运行 - 正如您已经在做的那样。

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

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

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

    在您的上述情况下,我怀疑您会将其调整为类似

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

    在您需要这些变量的任何地方将这些行插入脚本中,然后您就有变量“created”和“nonce”保存结果。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-28
      相关资源
      最近更新 更多