Kapil
June 13, 2018, 9:32am
1
Hi
Please see this template of Resources
.resources(
http(“request_16”)
.get(uri3 + “/config”)
.headers(headers_2),
http(“request_17”)
.options("/oauth2?code=${authCode}&redirect_uri=XXXXXXXXXXXXXXXX/oauth2redirect")
.headers(headers_3),
http(“request_18”)
.get("/oauth2?code=${authCode}&redirect_uri= XXXXXXXXXXXXXXXX/oauth2redirect")
//.check(jsonPath("$…access_token").optional.saveAs(“accessTOKEN”))
.check(headerRegex(“Set-Cookie”, “accessToken=(.*); Max-Age”).saveAs(“accessTOKEN”))
.check(status.in(200,204))
.headers(headers_4),
http(“request_19”)
.get(uri3 + “/config”)
.headers(headers_2),
http(“request_20”)
.options("/data/caseworkers/XX/profile")
.headers(headers_3),
http(“request_21”)
.get("/data/caseworkers/XX/profile")
//.headers(headers_4)))
.header(“Content-Type”, “application/json”)
.header(“Authorization”, "Bearer " + “${accessTOKEN}”)))
.pause(5)
I have managed to capture token value correctly in request_18 and I need to substitute the same value as Authorisation header on request_21. I tried all combination but substitution is failing all time and getting Failed to build request request_21: No attribute named 'access 1 (100.0%)
TOKEN’ is defined
Please can gatling expert advice me what I am doing wrong here ??
Regards
K
Kapil
June 13, 2018, 12:45pm
2
Hi Stephane,
Can you please suggest on this issue please ?
Kapil
June 14, 2018, 2:35pm
3
AS build request 21 is failed so I can not capture it via gatling log file ?
but manually I can capture header information through browser console as follows for request_21
GET /data/xxx/:uid/profile HTTP/1.1
Host: XXXXXXXXXXXXXXXXXXXXXX
Connection: keep-alive
Accept: application/json
Origin: XXXXXXXXXXXXXXXXXXXXXX
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36
Content-Type: application/json
Referer: h XXXXXXXXXXXXXXXXXXXXXXYYYYYYYY
Accept-Encoding: gzip, deflate, br
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Cookie: ARRAffinity=6aa46c21287465af04898c4122e86851bb65d86fb2466f00a5d21cc4f1486e1c; accessToken=eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxMnY1MjlzZzExcjVma2RtY2pxdG03MjViMCIsInN1YiI6IjE3NjQ3NSIsImlhdCI6MTUyODk4NjcyOCwiZXhwIjoxNTI5MDE1NTI4LCJkYXRhIjoiY2FzZXdvcmtlci1hdXRvdGVzdDEsY2FzZXdvcmtlci1hdXRvdGVzdDEtanVuaW9yLGNhc2V3b3JrZXItYXV0b3Rlc3QxLW1hbmFnZXIsY2FzZXdvcmtlci1hdXRvdGVzdDEtc2VuaW9yLGNhc2V3b3JrZXIsY2FzZXdvcmtlci1hdXRvdGVzdDEtbG9hMSxjYXNld29ya2VyLWF1dG90ZXN0MS1qdW5pb3ItbG9hMSxjYXNld29ya2VyLWF1dG90ZXN0MS1tYW5hZ2VyLWxvYTEsY2FzZXdvcmtlci1hdXRvdGVzdDEtc2VuaW9yLWxvYTEsY2FzZXdvcmtlci1sb2ExIiwidHlwZSI6IkFDQ0VTUyIsImlkIjoiMTc2NDc1IiwiZm9yZW5hbWUiOiJBdXRvIiwic3VybmFtZSI6IlRlc3QiLCJkZWZhdWx0LXNlcnZpY2UiOiJDQ0QiLCJsb2EiOjEsImRlZmF1bHQtdXJsIjoiaHR0cHM6Ly93d3ctY2NkLm5vbnByb2QucGxhdGZvcm0uaG1jdHMubmV0IiwiZ3JvdXAiOiJjYXNld29ya2VyIn0.3Mb5ncqNDrQCbhfIOdP3dC4TOdt3CH7ydIGSwBpEByo
Ethen
June 14, 2018, 3:43pm
4
recorded simulation?
try to split request into diffrent exec block ;
example can be found in $GATLING_HOME/user-files/simulations/computerdatabase/advanced/AdvancedSimulationStep03.scala
and maybe debug is helpful :
https://gatling.io/docs/current/general/debugging/
在 2018年6月14日星期四 UTC+8下午10:35:19,Kapil写道: