0
votes

I am trying to log extra response information in gatling result through, http.extraInfoExtractor. Below is my code, I am failing to execute the same, also mentioned the error. Please help.

Code :

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

Error

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
1

1 Answers

1
votes

extraInfoExtractor has been dropped with version 3.0 according to https://gatling.io/docs/current/migration_guides/2.3-to-3.0/:

extraInfoExtractor was dropped as it wasn’t used in any Gatling component

I am not aware of a replacement construct in Gatling 3.0

Greetings, Matthias