可以存储 JMeter 请求的结果并使用它吗?

发布于 2024-10-08 00:14:08 字数 231 浏览 0 评论 0原文

我正在尝试使用 Web 服务进行一些 JMeter 测试,但我对如何测试创建/删除功能有点困难。

创建是通过传入一些值来完成的。然而,删除只能通过使用创建的对象的 id 来完成,该 id 必须通过单独的调用来获取。因此,我不太确定如何设置 JMeter 来处理这个问题。

例如,是否可以存储创建调用的返回值(对象 ID),然后在我的删除请求中使用?

如果有人可以帮助或指出我正确的方向,我将不胜感激。

I'm trying to do some JMeter testing with a web service, but I'm a bit stymied on how to test the create/delete functionality.

Create is done by passing in some values. Delete, however, is only accomplished by using the created object's id, which must be obtained through a separate call. Thus, I'm not really sure how to set up JMeter to handle this.

Is it possible for, say, the return value of the create call (the object id) to be stored and then used in my delete request?

If anyone could help or point me in the right direction, it would be appreciated.

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

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

发布评论

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

评论(2

‖放下 2024-10-15 00:14:08

您可以使用名为“正则表达式提取器”的后处理器来获取将密钥放入局部变量并将其用于下一个请求。

另请参阅邮件列表中的此线程类似的要求

You can use the Post-Processor named "Regular Expression Extractor" to fetch the key into a local variable and use that for the next request.

also see this thread on the mailing list for a similar requirement

赠意 2024-10-15 00:14:08

使用 JDBC 请求,其中
- 变量名称:mysql(如果您的数据库是mysql)
- select 语句: select concat("id:'", id, "'") as id FROM your_table WHERE ...

向此 jdbc 请求附加正则表达式提取器:
- 参考名称:retrieved_id -->所以你可以将它用作 ${retrieved_id}
- 正则表达式:id:'(.+?)
- 模板:$1$

现在在您的测试中您可以使用 ${retrieved_id}

Using a JDBC request where
- variable name: mysql (if your db is mysql)
- select statement: select concat("id:'", id, "'") as id FROM your_table WHERE ...

To this jdbc request attach a regular expression extractor:
- reference name: retrieved_id --> so you can use it as ${retrieved_id}
- regular expression: id:'(.+?)
- template: $1$

Now in your tests you can use ${retrieved_id}

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