如何使用jmeter负载测试一个完整的逻辑流程?
How to load test a complete logical flow using jmeter?
我有三个API:
- 创建用户(returns 响应正文中的 userId)
- 添加与步骤 1 中创建的用户相对应的照片(在请求正文中获取 userId - 与在第一个正文的响应中获得的相同)
- 轮询 API 以检查用户照片更新是否完成(在请求正文中获取 userId - 与在第一个正文的响应中获得的相同)
运行这三个API构成了应用程序的一个逻辑流程。
我想 运行 并对三个 API 中的 'set' 进行基准测试。
在这方面我有以下担忧:
我应该如何决定是使用三个不同的线程组来 运行 这 3 个 API 还是一个线程组就足够了?
应该使用什么从第一个 API 响应中提取 'userID' 并将其用作第二个请求的输入。
如何在第三个 API 中根据需要实现轮询机制?
如果我说有 5 个用户点击请求 1,然后同样有 5 个用户点击请求 2,我如何在请求之间建立映射,以便第一个 API 的用户 1 映射到第二个 API?
How should I decide whether to have three different thread groups to run these 3 APIs or a single thread group should suffice ?
- 我会选择单个 Thread Group,因为它假定单个虚拟用户(或一组虚拟用户)的操作
What should be used to extract 'userID' from first API response and use it as an input to second request.
- 取决于响应类型,JSON Extractor for JSON, XPath Extractor for XML
How can I implement polling mechanism as needed in third API ?
- 使用 While Controller
If I have say 5 users hitting request1 and then the same 5 users hitting request 2, how can I establish mapping between requests so that user1 by first API gets mapped to second API ?
- 你不需要做任何事情,每个JMeter线程(虚拟用户)执行samplers upside down and all the context like variables is local to this user (thread)
我有三个API:
- 创建用户(returns 响应正文中的 userId)
- 添加与步骤 1 中创建的用户相对应的照片(在请求正文中获取 userId - 与在第一个正文的响应中获得的相同)
- 轮询 API 以检查用户照片更新是否完成(在请求正文中获取 userId - 与在第一个正文的响应中获得的相同)
运行这三个API构成了应用程序的一个逻辑流程。 我想 运行 并对三个 API 中的 'set' 进行基准测试。 在这方面我有以下担忧:
我应该如何决定是使用三个不同的线程组来 运行 这 3 个 API 还是一个线程组就足够了?
应该使用什么从第一个 API 响应中提取 'userID' 并将其用作第二个请求的输入。
如何在第三个 API 中根据需要实现轮询机制?
如果我说有 5 个用户点击请求 1,然后同样有 5 个用户点击请求 2,我如何在请求之间建立映射,以便第一个 API 的用户 1 映射到第二个 API?
How should I decide whether to have three different thread groups to run these 3 APIs or a single thread group should suffice ?
- 我会选择单个 Thread Group,因为它假定单个虚拟用户(或一组虚拟用户)的操作What should be used to extract 'userID' from first API response and use it as an input to second request.
- 取决于响应类型,JSON Extractor for JSON, XPath Extractor for XMLHow can I implement polling mechanism as needed in third API ?
- 使用 While ControllerIf I have say 5 users hitting request1 and then the same 5 users hitting request 2, how can I establish mapping between requests so that user1 by first API gets mapped to second API ?
- 你不需要做任何事情,每个JMeter线程(虚拟用户)执行samplers upside down and all the context like variables is local to this user (thread)