1

How to pass a variable to .get method in Gatling script. Here i am having Json file and need to pass a variable dynamically. My Json Value is

[{ "id" = "Test1"}, {"id" = "Test2"}

Here is my gatling Script

 .feed(jsonFile("gabdeviceid.json").circular)
            .during(10 minute) {
             exec(http("request_0")
                    .get("/user/isTokenValid?id=${id}")
                    .headers(headers_0))
            }

Error: getting 405

but replace ${id} with Test1 it's working fine.

anywhere i done mistake can any one help me please.

sreenivas
  • 399
  • 2
  • 5
  • 20

1 Answers1

1

Change the formatting of your string:

.get("/user/isTokenValid?id=%s").format("${id}")

Whole script:

.feed(jsonFile("gabdeviceid.json").circular)
            .during(10 minute) {
             exec(http("request_0")
                    .get("/user/isTokenValid?id=%s").format("${id}")
                    .headers(headers_0))
            }
Stanko
  • 4,275
  • 3
  • 23
  • 51