【问题标题】:Gatling request is not getting executed加特林请求未得到执行
【发布时间】:2020-10-23 10:29:50
【问题描述】:
    val makeReport =
      feed(randomNumberFeeder)
        .exec( session => {
          http("post_report")
            .post("/api/path/reports")
            .body(StringBody(JsonFactory.report(id = 1, number= session("number").asOption[String].get))).asJson
            .check(jsonPath("$.reportId").saveAs("reportId"))
          session
        })

val scn = scenario("ReportCreation").exec(makeReport)

但是当我运行 Gatling 测试时,请求没有被发送,整个 HTTP 块被忽略。我哪里错了?

所以我最终会遇到以下异常。

Exception in thread "main" java.lang.UnsupportedOperationException: There were no requests sent during the simulation, reports won't be generated
    at io.gatling.charts.report.ReportsGenerator.generateFor(ReportsGenerator.scala:50)
    at io.gatling.app.RunResultProcessor.generateReports(RunResultProcessor.scala:65)
    at io.gatling.app.RunResultProcessor.processRunResult(RunResultProcessor.scala:40)
    at io.gatling.app.Gatling$.start(Gatling.scala:89)
    at io.gatling.app.Gatling$.fromArgs(Gatling.scala:45)
    at io.gatling.app.Gatling$.main(Gatling.scala:37)
    at io.gatling.app.Gatling.main(Gatling.scala)

【问题讨论】:

标签: scala gatling scala-gatling


【解决方案1】:

我自己修好了。

      val makeReport =
      feed(randomNumberFeeder)
        .exec(http("post_report")
            .post("/api/path/reports")
            .body(StringBody( session => JsonFactory.report(id = 1, number= session("number").as[String]))).asJson
            .check(jsonPath("$.reportId").saveAs("reportId"))

        })

【讨论】:

    猜你喜欢
    • 2015-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多