soapUI中的Groovy脚本和属性传输 [英] Groovy Script and Property transfer in soapUI

查看:220
本文介绍了soapUI中的Groovy脚本和属性传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以从groovy script运行Property Transfer步骤?两者都在同一个测试用例中.

Is there any way in which I can run a Property Transfer step from a groovy script? Both are in the same test case.

测试用例包含以下测试步骤:

  1. 常规脚本
  2. soapUI请求(GetAccountNumber)
  3. 财产转移步骤(在下面的步骤中将响应属性从上方转移到请求属性)
  4. soapUI请求(DownloadURL)

我需要确保流程如下:

  1. Groovy运行并从文件中读取数字,并将其传递给GetAccountNumber.
  2. GetAccountNumber与传递的值一起运行并生成响应.
  3. 此响应通过属性转移步骤传递到DownloadURL.
  4. DownloadURL使用此传递的值运行并生成输出.

我需要做的就是从groovy运行属性转移,因为其他步骤可以从groovy运行.

All I need to do is run the Property Transfer from the groovy because the other steps can be run from groovy.

它未与以下代码一起运行

It isn't running with the following code

def testStep_1 = testRunner.testCase.getTestStepByName("PropertyTransfer") 
def tCase_1 = testRunner.testCase.testSuite.testCases["SubmitGenerateReport"] 
def tStep_1 = tCase.testSteps["PropertyTransfer"] 
tStep_1.run(testRunner, context)

推荐答案

在没有更多上下文的情况下,我认为您的问题是一个简单的错字,您得到了testCase并关联到tCase_1:

Without more context I think that your problem is a simple typo, you get your testCase and assing to tCase_1:

def tCase_1 = testRunner.testCase.testSuite.testCases["SubmitGenerateReport"];

但是要获取tStep_1,请使用tCase而不是tCase_1:

However then to get the tStep_1 you use tCase instead of tCase_1:

def tStep_1 = tCase.testSteps["PropertyTransfer"]; tStep_1.run(testRunner, context);

此外,如果要从常规运行的testStep与要执行的同一testCase,则为testCase.您只需使用以下命令即可运行它:

Additionally if the testStep you want to run from groovy are in the same testCase you're executing; you can run it simply using:

testRunner.runTestStepByName('some teststep name')

我认为这比从testCase获取testStep然后运行它更方便.

Which I think it's more convenient than get the testStep from the testCase and then run it.

希望有帮助,

这篇关于soapUI中的Groovy脚本和属性传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆