Java OpenResty Spring Spring Boot MySQL Redis MongoDB PostgreSQL Linux Android Nginx 面试 小程序 Arthas JVM AQS juc Kubernetes Docker 诊断工具


JMeter 使用 Critical Section Controller 按顺序执行接口

JMeter 大约 407 字

版本

基于Apache JMeter 5.4.1

原因

虽然在Thread Group中的接口是按顺序排布,但执行压测时,是随机执行的。但有一些接口是需要有顺序关系的,如:先下单,再付款,最后发货。

Critical Section Controller

临界部分控制器。

在该控制器下的接口都将会添加一个锁,保证顺序完成。

注意

如是固定值,则即使再多线程,那么同一时刻只会执行一个。

可以设置从CSV中读取变量,设置锁为CSV中读取的值。

步骤

  1. 右击Thread Group
  2. 选择Add
  3. 选择Logic Controller
  4. 选择Critical Section Controller
  5. Critical Section Controller中添加锁名称

图示

添加Critical Section Controller

Critical Section Controller.png

设置锁名称,此处从CSV配置中设置的username变量${username}

Critical Section Controller2.png

阅读 2313 · 发布于 2021-08-23

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb

扫描下方二维码关注公众号和小程序↓↓↓

扫描二维码关注我
昵称:
随便看看 换一批