Gatling 设置顺序场景

Gatling setUp Sequential Scenarios

Gatling documenation 状态:

Sequential Scenarios It’s also possible with andThen to chain scenarios so that children scenarios starts once all the users in the parent scenario terminate.

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)))
                  

             ^

我正在使用加特林 3.3.1

我发现了这个功能: https://github.com/gatling/gatling/issues/3830

适用于 Gatling 3.4.0 :-)

我确实找到了 'current' 文档 并且没有注意到 3.3 中不存在该功能: https://gatling.io/docs/3.3/general/simulation_setup/

请检查 the ticket for this feature or the new features list 上的里程碑字段:andThen 是在 Gatling 3.4.0 中引入的,因此在 Gatling 3.3.1 中不可用。