加特林设置顺序场景



Gatling文档州:

连续的场景还可以使用andThen来链接场景,以便在父场景中的所有用户终止时启动子场景。

setUp(
parent.inject(injectionProfile)
// child1 and child2 will start at the same time when last parent user will terminate
.andThen(
child1.inject(injectionProfile)
// grandChild will start when last child1 user will terminate
.andThen(grandChild.inject(injectionProfile)),
child2.inject(injectionProfile)
)
)

但是下面的代码不能编译:

setUp(
scenario("A").inject(atOnceUsers(1))
.andThen(scenario("B").inject(atOnceUsers(1)))
)

编译错误:

type mismatch;
found   : io.gatling.core.structure.PopulationBuilder
required: io.gatling.commons.validation.Validation[io.gatling.core.structure.PopulationBuilder] => ?
.andThen(scenario("B").inject(atOnceUsers(1)))

^

我使用的是gatling 3.3.1

请检查此功能或新功能列表中的里程碑字段:andThen是在Gatling 3.4.0中引入的,因此在Gatling 3.3.1中不可用。

我发现了这个特性:https://github.com/gatling/gatling/issues/3830

可以在Gatling 3.4.0中使用:-)

确实,我落在了"当前"文档上并且没有注意到该功能在3.3中不存在:https://gatling.io/docs/3.3/general/simulation_setup/

最新更新