新手区 Gatling 录制功能使用

xiuxiuing · October 15, 2018 · 1245 hits

Gatling 提供了可视化的接口录制功能,我们无须写任何代码,通过录制功能可以自动生成性能测试所需要的脚本。

上篇文件如何配置 IntelliJ 的开发环境,本文将谈谈如何使用录制功能。

  1. 在 IntelliJ 中选择Recorder文件右键运行,即可打开 Gatling 录制的界面,如果不是使用 IntelliJ 来开发,运行/bin/recorder.sh 命令也是可以启动录制界面的。
    {% asset_img Gatling 录制.png %}
    设置完成后,点击start,开始录制。

  2. 在 Firefox 设置中,设置网络代理
    {% asset_img proxy.png %}

  3. 使用类似 PostMan 的工具,模拟发送 http 请求
    {% asset_img postman.png %}
    如果使用的 Https 协议的话,需要添加例外
    {% asset_img liwai.png %}

  4. Gatling 客户端则会监听到接口请求,接口录制完成后,点击Stop & Save
    {% asset_img save.png %}

  5. 在 IntelliJ 中可以看到录制完后自动生成的脚本
    {% asset_img IntelliJ.png %}
    由于录制过程中会有我们不需要的请求,可以在脚本中删除。

  6. 点击Engine脚本右键即可运行我们录制的脚本了。

    com.xiuxiuing.RecordedSimulation is the only simulation, executing it.
    Select simulation id (default is 'recordedsimulation'). Accepted characters are a-z, A-Z, 0-9, - and _
    
    Select run description (optional)
    
    Simulation com.xiuxiuing.RecordedSimulation started...
    
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 0 条回复 时间 点赞
xiuxiuing Gatling 性能测试 从入门到精通 中提及了此贴 15 Oct 21:08
xiuxiuing [Topic was deleted] 中提及了此贴 18 Oct 14:01
xiuxiuing 专栏文章:Gatling 教程目录 中提及了此贴 19 Oct 16:31
需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up