I googled a lot on how to parametrize the script to accommodate more virtual users in test scenarios(Gatling 2). There is documentation for feeders(csv,json, etc…) The recorded script will have a text file generated in the “request-bodies” folder. So feeders are not helping here. Do I need to make edits to that file in order to serve the purpose as shown below(say for 5 users) -
{“login”:{“username”:“user1”,“password”:“hhjhjj”}}
{“login”:{“username”:“user2”,“password”:“yutyu”}}
{“login”:{“username”:“user3”,“password”:“vbnvb”}}
{“login”:{“username”:“user4”,“password”:“piopi”}}
{“login”:{“username”:“user5”,“password”:“qweq”}}
OR
is there a better/correct way to do this?
Please help me out, been weeks I got stuck here
Had to post since I couldn’t find a way out after considerable amount of research.
Feeders are simple and straightforward - http://gatling.io/docs/2.0.3/session/feeder.html
Steps
-
Create a feeder file (parameter) eg: users.csv.
userName,userPwd
uid1, pwd1
uid2, pwd2 …
-
Save this file in data folder of gatling_home
-
In your scripts declare feeder. eg: val userFeeder = csv(“users.csv”) .random // you can use circular also. look at documentation for all options
-
before your exec chain, where you need to use these uid,pwd, call this feed(userFeeder).exec …
-
In your exec chain, call the parameters ({“login”:{“username”:"${userName}","${userPwd}":“hhjhjj”}} //First line in the parameter file is used as parameter variables
HTH
First off, thank you for post and sorry for the late reply. I followed the same as you have mentioned and Gatling threw an error in the end.
"Failed to build request: Illegal character in path at index 16: xyz.txt".
Am I missing the correlation part? If so, can you please explain that as well in simple terms like illustration with an example? Would be of great help!
It seems like you have an illegal character in your feeder file. See if you can find an issue there. If not, post your code and feeder file and will take a look at that.