当前位置 : 主页 > 网络安全 > 测试自动化 >

性能 – 如何为不同的HTTP请求分配用户数?

来源:互联网 收集:自由互联 发布时间:2021-06-22
我的方案是允许25个用户点击一个HTTP请求,75个用户请求另一个请求,同时使用一个或多个线程组. 1. Default Request: www.abc.com 2. 25 Users should hit www.abc.com/firstrequest 3. 75 Users should hit www.abc.com
我的方案是允许25个用户点击一个HTTP请求,75个用户请求另一个请求,同时使用一个或多个线程组.

1. Default Request: www.abc.com
   2. 25 Users should hit www.abc.com/firstrequest
   3. 75 Users should hit www.abc.com/secondrequest

如何使用Jmeter同时允许在两个或多个不同请求中分配用户?

是的,您可以使用同步计时器,但仅针对请求而不是多个请求.

但是可以通过调整来实现所需的负载.

1. suppose you have 2 threadgroups having 1 request each. i.e. firstrequest and secondrequest 
2. create synchronizing timer as a child of testplan (by this it will be applicable to both threadgroups)
3. put no. of threads to group by as 100 (as you want 25 users to hit firstrequest and 75 users to hit secondrequest simulataneously, which means 100 concurrent users)
4. assign 25 thread count to first threadgroup
5. assign 75 thread count to first threadgroup 
6. Allow running threadgroups in parallel by not checking run threadgroups consecutively checkbox in testplan

这样您就可以生成100个并发用户来测试2个请求.如果您不希望同时命中2个请求,则可以向每个线程组添加同步计时器并运行测试.

网友评论