Jmeter里面有三种线程组:setUp thread group, TearDown thread group, thread group. 如果想定义100个用户登录系统,60个用户做A操作,40用户做B操作。我认为可以这样定义:
1. 测试计划中复选框“独立运行每个线程组”应该是非选中状态;
2. 在测试计划中添加一个SetUp thread group, 设置用户数是100;
3. 还要添加两个普通线程组,分别定义60线程和40线程。
经过一段时间的摸索,我发现上面的描述是错误的。
如果新定义线程组,该线程组与前面的setup thread group线程组不一定会联系在一起的。
设定一个场景:
定义100个人登录系统,60个人做A操作30次,40个人做B操作20次,如何实现?
请求数:60 * 30 + 40 * 20 = 2600
每个人请求数:2600 / 100 = 26
在Jmeter里面,设定线程数:100
定义26次循环。
登录请求放在一次性控制器里面
A,B请求放在吞吐量控制器里面,其中A:B请求的百分比是:70:30