Hey Everyone,
I am using Gatling 3. I have a csv feeder with just one column titled “accountIds”. I need to pass more than one random records from the feeder in the body of my POST request. I do it like this:
val searchFeeder = csv("data/accountids.csv").random
val scn1 = scenario("Scenario 1") // A scenario is a chain of requests and pauses
.feed(searchFeeder,2)
.exec(http("Search")
.post("/v3/accounts/location/search")
.body(StringBody("""{"accountIds": ["${accountIds}"]}""")).asJson)
setUp(scn1.inject(atOnceUsers(10)).protocols(httpConf))
I get the error:
Failed to build request: No attribute named ‘accountId s’ is defined
This works fine if I remove the 2 from the feed function and use just one argument in .feed(searchFeeder).
Thank you for the help
Failed to build request: No attribute named ‘accountId s’ is defined
It looks like you have copy pasted a non printable character between the ‘d’ and the ‘s’ characters in your Gatling expression.
That might be a typo from my end. I changed the column header of the file to accounts. I still get the same error:
Search: Failed to build request: No attribute named ‘accounts’
is defined
No, that’s not the same error.
Search: Failed to build request: No attribute named ‘accounts’
Yes but I changed the column header of my csv file to ‘accounts’. This is the change:
val scn1 = scenario("Scenario 1")
.feed(searchFeeder,2)
.exec(http("Search")
.post("/v3/accounts/location/search")
.body(StringBody("""{"accountIds": ["${accounts}"]}""")).asJson)
This works perfectly well if I remove the 2 from the feed function.
Also, I have tried it with feeders other than csv. The error remains.
Thank you for the help.
Should it be “${accounts1}” and “${accounts2}”?https://gatling.io/docs/current/session/feeder