Gatling 录制功能使用

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/meifannao789456/article/details/82773219

为了更好的阅读,请点击个人网站:https://xiuxiuing.gitee.io/blog/2018/09/18/gatlingrecorder/
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...
    

猜你喜欢

转载自blog.csdn.net/meifannao789456/article/details/82773219