SOAPUI如何生成动态请求密码?

发布于 2025-02-06 04:56:40 字数 131 浏览 1 评论 0原文

我需要动态地生成请求的密码,因为我需要将其与时间戳加在一起,并将结果与​​SHA-256编码以获取实际密码。

有没有办法向每个请求生成该密码?

应该在哪里创建脚本以生成密码,以及如何将其添加到请求或在请求中读取的变量中?

I need to generate the password of the request dynamically, because I need to concatenate it with a timestamp and encode the result with SHA-256 to get the actual password.

Is there a way to generate that password to every request?

Where should the script be created to generate the password, and how can it be added to the request or to a variable that is read in the request?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白首有我共你 2025-02-13 04:56:40

您可以在Soapui中完全访问Groovy语言。您可以在Groovy脚本测试步骤中进行任何形式的编码。然后,您可以将结果值存储在a

testRunner.testCase.setPropertyValue("passwordVar", passwdResult)

在请求xml中,您将要从属性读取的值进行参数化:

<passwordNode>${#TestCase#passwordVar}</passwordNode>

唯一的收获是您必须在肥皂请求步骤之前执行Groovy步骤,但可以在测试案例级别或在循环循环开朗,具体取决于您的项目结构。我通常会有一个令人愉悦的脚本,该脚本:

  • 进行计算或SQL以获取输入值
  • 集属性属性
  • 调用soap步骤
  • RESP XML提取所需的响应值。

从循环中的

You have full access to the Groovy language in SoapUI. You can do any sort of coding in a Groovy script test step. Then you can store the resulting value in a property:

testRunner.testCase.setPropertyValue("passwordVar", passwdResult)

And in the request XML you parameterize the value to be read from the property:

<passwordNode>${#TestCase#passwordVar}</passwordNode>

The only catch is that you will have to execute the Groovy step before the SOAP request step, but that can be done at test case level, or in a loop in Groovy, depending on your project structure. I usually have a Groovy script that:

  • does calculations or SQL to get input values
  • sets properties
  • calls the SOAP steps
  • extract required response values from resp XML

in a loop.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文