JMeter 异步 API 调用 [英] JMeter Asynchronous API calls

查看:18
本文介绍了JMeter 异步 API 调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Jmeter 测试的移动应用程序在登录时进行了 4 个异步 API 调用.有没有办法用 JMeter 模拟这一点?

目前我只能让JMeter同步调用,所以当把它们都包装在同一个事务控制器中时,响应时间是4次调用的总和(而不是最高的一次)

非常感谢

解决方案

目前 JMeter 不提供相关的测试元素,实现您的场景的最简单方法是使用

请参阅 如何使用 JMeter 加载测试支持 AJAX/XHR 的站点 指南以获得更详细的解释、代码片段等.

您还可以考虑开发具有类似功能的自定义采样器并将其作为一部分将您的 JMeter 作为插件使用,甚至与社区共享.

The mobile app that I am testing with Jmeter makes 4 asynchronous API calls when logging in. Is there any way to simulate this with JMeter ?

Currently I can only get JMeter to make the calls synchronously, so when wrapping them all in the same transaction controller, the response time is the total of the 4 calls (instead of the highest one)

Many thanks

解决方案

Currently JMeter doesn't offer a relevant test element, the easiest way of implementing your scenario is using JSR223 Sampler to perform nested asynchronous calls, something like:

See How to Load Test AJAX/XHR Enabled Sites With JMeter guide for more detailed explanation, code snippets,etc.

You can also consider developing a custom sampler with similar functionality and make it a part of your JMeter as a plugin or even share it with the community.

这篇关于JMeter 异步 API 调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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