加特林-顺序执行方案 [英] Gatling - execute scenarios sequentialy

查看:116
本文介绍了加特林-顺序执行方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行以下代码时:

setUp(
     scenario1.inject(constantUsersPerSec(1) during (1 second)),
     scenario2.inject(constantUsersPerSec(1) during (1 second))
).protocol()

两种情况都立即启动.
要一一运行它需要更改什么?

Both scenarios are started at once.
What need to be changed to run it one by one?

推荐答案

您可以使用"nothingFor"注入步骤开始第二种方案

You could start the second scenario with a "nothingFor" injection step

setUp(
   scenario1.inject(constantUsersPerSec(1) during (1 second)),
   scenario2.inject(nothingFor(1 second) ,
                    constantUsersPerSec(1) during (1 second))
).protocol()

如果要保证有序执行,则必须将两个方案的链放入新方案中.

If you want to have a guaranteed sequential execution, you have to put the chains of both scenarios into a new scenario.

var scn = scenario("combined scenario").
           .exec(chain1)
           .exec(chain2)

def chain1 = exec(...)...
def chain2 = exec(...)...

通常,我将页面(已记录,易失)的脚本与用户场景序列(页面调用链)和负载模型(带有注入步骤的设置)分开,这使得重组链以创建新脚本变得更加容易场景.

Usually I separate the scripts for a page (recorded, volatile) from the user scenario sequences (chains of page calls) and the load model (the setup with the injection steps), which makes it easier to recombine chains to create new scenarios.

这篇关于加特林-顺序执行方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆