无法在Gatling Script中实现.extraInfoExtractor

问题描述 投票:0回答:1

我试图通过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个回答
0
投票

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

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

我不知道Gatling 3.0中的替换构造

问候,马蒂亚斯

© www.soinside.com 2019 - 2024. All rights reserved.