gatling_101
Gatling 3 Fundamentals
- 基本步骤
- 创建http client,初始化url,请求头部格式等等
- http.baseUrl
- 创建测试场景
- scenario 定义测试场景
- exec 声明测试的endpoint
- http
- get/post/put ….
- check 检查response结果
- eg: check(status.is(200)))
- pause 设置等待时间
- 执行测试
- setUp
- inject 注入
- atOnceUsers 测试并发量
- 设置http configuration
- protocols
- 设置测试的并发量
- inject 注入
- setUp
- 执行测试采用cmd模式
mvn gatling:test -Dgatling.simulationClass=simulations.RunTimeParameters
- 参数前面加上-D表示读取命令行中的参数
- eg:
mvn gatling:test -Dgatling.simulationClass=simulations.RunTimeParameters -DUSERS=10 -DRAMP_DURATION=5 -DDURATION=30
- eg:
- 创建http client,初始化url,请求头部格式等等
- Title: gatling_101
- Author: Xiao Qiang
- Created at : 2023-03-05 15:11:56
- Updated at : 2025-03-08 10:49:30
- Link: http://fdslk.github.io/tech/test/gatling/2023/03/05/gatling-101/
- License: This work is licensed under CC BY-NC-SA 4.0.
Comments