加特林请求未得到执行

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

蓝人

我自己修好了。

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

        })

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章