【问题标题】:Gatling : session.isFailed returning true even the previously executed request has succeededGatling : session.isFailed 返回 true,即使之前执行的请求已经成功
【发布时间】:2021-01-05 18:25:04
【问题描述】:

我的任务是运行一些性能测试,以便对我们的系统进行基准测试。我设计的场景如下:

var scn: ScenarioBuilder = scenario("Sample Scenario")
    .exec(
      forever(
        exec(<first request>)
          .pause(2, 5)
          .doIf(session => !session.isFailed) {
            randomSwitch(
              70d -> exec(<second request>),
              15d -> exec(<third request),
              15d -> exec(<fourth request>)
            )
          }
      )
    )

当我们在系统中执行故障转移测试时,我面临的问题突然出现。我注意到,在模拟过程中,一旦系统中出现故障,所有请求在“第一个请求”之后都停止执行。

我检查了日志,“第一个请求”成功,根据我的理解,!session.isFailed 条件应该为真,以便进一步执行场景。

谁能分享一下为什么将条件标记为false而不是true

【问题讨论】:

    标签: performance gatling scala-gatling


    【解决方案1】:

    根据 Gatling.io 团队:


    即使经过多次请求,会话也会保持其状态。

    正如你所说,a failure was introduced in the system

    主要目标之一是在您的场景中设置虚拟用户可能会离开(由于失败)exitHereIfFailed

    如果要恢复,应将会话标记为成功。

    var scn: ScenarioBuilder = scenario("Sample Scenario")
        .exec(
          forever(
            exec(session => session.markAsSucceeded) // <---- reset the status
              .exec(<first request>)
              .pause(2, 5)
              .doIf(session => !session.isFailed) {
                randomSwitch(
                  70d -> exec(<second request>),
                  15d -> exec(<third request),
                  15d -> exec(<fourth request>)
                )
              }
          )
        )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-17
      • 1970-01-01
      • 1970-01-01
      • 2015-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多