Gatling Error when running multiple users – ‘httpRequest-2’ failed to execute: No attribute named ‘access_token’ is defined


im new to Gatling and have been trying to setup a test where my users login, get an access token, then perform some simple get requests using that token. Having 1-2 users works fine, however once i start ramping up the users i start getting spammed with this error:

[ERROR] i.g.h.a.HttpRequestAction - 'httpRequest-2' failed to execute: No attribute named 'access_token' is defined

Im thinking it could have something to do with the way I am saving and using the access token ?

class GatlingTest extends Simulation {

    val httpProtocol = http
        .inferHtmlResources(BlackList(""".*.js""", """.*.css""", """.*.gif""", """.*.jpeg""", """.*.jpg""", """.*.ico""", """.*.woff""", """.*.woff2""", """.*.(t|o)tf""", """.*.png""", """.**"""), WhiteList())

    object GetUserData {

        val userData = exec(http("Get_User_Data")
            .header("Authorization", "Bearer ${access_token}"))

    object GetUserInfo {

        val userInfo = exec(http("Get_User_Info")
            .header("Authorization", "Bearer ${access_token}")
            .header("Accept", "application/json"))


    object Login {
        val sentHeaders = Map("api_key" -> "nnxzv336wt2374h6zw5x24qd", "Content-Type" -> "application/x-www-form-urlencoded", "Accept" -> "application/json")

        val login = exec(http("Login_User")
            .basicAuth("username", "password")
            .body(StringBody("grant_type=password&[email protected]&password=12345"))


    val user = scenario("User").exec(Login.login).exec(GetUserData.userData, GetUserInfo.userInfo)


I have added Authorization Bearer to the get requests, like i mentioned it does work, but as soon as 3+ users are involved i get the error.


It means the login request failed and hence, the user wasn’t able to capture the access_token there.

Leave a Reply

Your email address will not be published. Required fields are marked *