I am capturing auth token as part of first request and trying to use it in the second, but getting the same error “failed to execute: No attribute named ‘authToken’ is defined”. Can someone tell me what am i doing wrong? Because in the execution results, i can see authToken being captured in the session data.
`
package computerdatabase
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
class Test1 extends Simulation {
val httpProtocol = http.baseUrl(“https://trustbroker.com”)
val httpProtocol_1 = http.baseUrl(“https://services.com”)
val header = Map(
“Content-Type” → “application/soap+xml;charset=UTF-8”,
“Connection” → “alive”,
“User-agent” → “Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0”)
val header_1 = Map(
//“Authorization”->"${authToken}",
“actor”->“TEST”,
“log_token”->“LOG”,
“scope”->“read”,
“timestamp”->“123456789”
)
val layer7 = scenario(“getauth”).exec(http(“GetAuthToken”)
.post("/auth/oauth/v2/token")
.queryParam(“client_id” , “123abcndfhgj”)
.queryParam(“client_secret” , “khkdh188d868d68d68f68”)
.queryParam(“grant_type” , “clienttest”)
.asJson.check(status.is(200)).check(jsonPath("$.access_token").find.saveAs(“authToken”)))
val pl1 = scenario(“claim”).exec(http(“claims”)
.post("/v1.0/search")
.headers(header_1)
.header(“Authorization”,“bearer ${authToken}”)
.body(StringBody("""<?xml version="1.0" encoding="utf-8"?>
123456
20
“”")))
setUp(layer7.inject(rampUsers(1) during (1 seconds)).protocols(httpProtocol_1),
pl1.inject(nothingFor(10 seconds),
rampUsers(10) during (5 seconds)).protocols(httpProtocol))
}
`