【问题标题】:Cannot implement .extraInfoExtractor in Gatling Script无法在加特林脚本中实现 .extraInfoExtractor
【发布时间】:2019-03-28 12:07:10
【问题描述】:

我正在尝试通过 http.extraInfoExtractor 在 gatling 结果中记录额外的响应信息。下面是我的代码,我没有执行同样的代码,也提到了错误。请帮忙。

代码:

package cloudnative

import scala.concurrent.duration._

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._

class cloudnativems extends Simulation {

        val nbUsers = Integer.getInteger("users", 1)
        val myRamp = java.lang.Long.getLong("ramp", 0L)
        val varPipelineId = sys.env.get("CI_PIPELINE_ID")
        println(varPipelineId)

        val httpProtocol = http
                .baseUrl("https://lXXXXXXXXXX")
                .inferHtmlResources()
                .contentTypeHeader("application/json")


        val scn = scenario("cloudnativems")
                .exec(http("account_movement_post")
                        .post("/XXXXXXX/gatling-poc/demo/movement/account")
            .extraInfoExtractor(extraInfo => List(extraInfo.response.statusCode.get))
                        .body(StringBody("""{
                "movementId": "m0001",
                "accountId": "a0001",
                "amount": 2000,
                "movementDate":  "2019-02-26T09:34:50.301Z",
                "counterparty": "c0001"
                  }""")))


                .exec(http("account_movement_get")
                        .get("/XXXXXXX/gatling-poc/demo/movement/account/m0001")
                        )
        setUp(scn.inject(atOnceUsers(1)).protocols(httpProtocol))
}

错误

C:\Sopra Project\Tools\gatling-charts-highcharts-bundle-3.0.3\bin>gatling.bat -s cloudnative.cloudnativems
GATLING_HOME is set to "C:\Sopra Project\Tools\gatling-charts-highcharts-bundle-3.0.3"
JAVA = ""C:\Program Files\Java\jdk1.8.0_201\bin\java.exe""
11:56:14.849 [ERROR] i.g.c.ZincCompiler$ - C:\Sopra Project\Tools\gatling-charts-highcharts-bundle-3.0.3\user-files\simulations\cloudnative\cloudnativems.scala:25:8: value extraInfoExtractor is not a member of io.gatling.http.request.builder.HttpRequestBuilder
possible cause: maybe a semicolon is missing before `value extraInfoExtractor'?
                                                .extraInfoExtractor(extraInfo => List(extraInfo.response.statusCode.get))
                                                 ^
11:56:15.190 [ERROR] i.g.c.ZincCompiler$ - one error found
11:56:15.193 [ERROR] i.g.c.ZincCompiler$ - Compilation crashed
sbt.internal.inc.CompileFailed: null

【问题讨论】:

    标签: scala performance-testing gatling scala-gatling


    【解决方案1】:

    根据https://gatling.io/docs/current/migration_guides/2.3-to-3.0/,extraInfoExtractor 已从 3.0 版中删除:

    extraInfoExtractor 已被删除,因为它没有在任何 Gatling 组件中使用

    我不知道 Gatling 3.0 中有替代构造

    您好, 马蒂亚斯

    【讨论】:

      猜你喜欢
      • 2021-11-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-16
      • 2017-03-11
      • 1970-01-01
      • 2014-09-22
      • 1970-01-01
      相关资源
      最近更新 更多