My Website creates token for every user. How can I assign unique access token dynamically

I have website that assign token to every user. in my script the access token get over ridden once other user uses the token url.
Please guide for a solution using chainbuilder if possible.

Hi @agandhi,

I’m not sure to understand your requirements or how your website works.

Common patterns involve that each virtual user will have a login/password to authenticate against the website and then used the provided token for following requests.

In that scenario, you can create a csv file with a lot of login/password pair in your system under test and use it as a feeder in your scenario.


Then, your scenario (the description for one virtual user) will call the login, save the provided token in a session variable then use this token in each request.

    FeederBuilder<String> feeder = csv("users.csv");

    ActionBuilder login = http("login")
            .formParam("login", "#{login}") // from feeder
            .formParam("password", "#{password}") // from feeder
                    header("X-Token").saveAs("token") // save the content of X-Token header in session variable named "token"

    ActionBuilder privatePage = http("private page")
            .header("Token", "#{token}") // use the "token" session variable

    ScenarioBuilder scn =
            scenario("With login")
                    .feed(feeder) // each virtual user will read 1 line of your file

Does it help?


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.