如何通过Groovy设置SOAPUI测试步骤的请求值

发布于 2025-01-31 15:48:28 字数 549 浏览 1 评论 0原文

在使用Groovy进行SOAPUI测试套件时,我能够阅读特定测试步骤的响应,例如:

responseString = testRunner.testCase.testSteps["GetUserService"].testRequest.response.responseContent;
log.info "responseString -" + responseString;

现在如何使用Groovy编程将请求主体发送到测试步骤,例如此GetUserService?

我可以想象这是这样的:

JSON_PayloadString="A JSON Payload String";
testRunner.testCase.testSteps["GetUserService"].testRequest.request.setValue(JSON_PayloadString);
testRunner.runTestStepByName("GetUserService")

但是我总是会遇到语法错误。

谁能帮助我的问题?多谢!

When using Groovy for SoapUI test suites, I'm able to read the response from a specific test step, e.g.:

responseString = testRunner.testCase.testSteps["GetUserService"].testRequest.response.responseContent;
log.info "responseString -" + responseString;

Now how can use Groovy programmatically send a request body to the test step, e.g. this GetUserService?

I could imagine it is something like this:

JSON_PayloadString="A JSON Payload String";
testRunner.testCase.testSteps["GetUserService"].testRequest.request.setValue(JSON_PayloadString);
testRunner.runTestStepByName("GetUserService")

But I always getting syntax errors.

Can anyone help on my question? Thanks a lot!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文