Hi,
This is my first post to this group. I recently started working on Gatling and scala . Hope I can understand the problem in my code here. Does the scope of the first row of data read from feeder, stays until the end of the scenario? Please see my code below.
I am trying to pass values to two different http calls from a csv feeder. In the first request I am able to pass the first column from the csv file.
but in http(“loginPost”), when I try to post the second column from csv file, it does not pass anything.
csv file is like this:
userName,deviceId
test33@abc.com,84662a38-1b43-4c76-8b2d-45d285363a00
test34@abc.com,84662a38-1b43-4c76-8b2d-45d285363a00
val scn = scenario(“RecordedSimulation”)
.feed(csv(“umsusers.csv”))
.exec(http(“createUserOptions”)
.options("/qp/ums/v1/createUser?apiKey=qwerty")
.headers(headers_0))
.exec(http(“createUserPost”)
.post("/qp/ums/v1/createUser?apiKey=qwerty").asJSON
.headers(headers_1)
//Passing userName from the csv file here****************************** This is working
.body(StringBody("""{“email”:"${userName}",“password”:“Welcome1@”,“g-recaptcha-response”:“03AHJ_VuxnLsqTcVcLPRYVXkJSegWvd3”,“optInForMarketingEmails”:true}"""))
)
.exec{
session =>
println("account id for " )
println(session(“userName”).as[String])
println(session(“AccountId”).as[String])
session
}
.pause(1)
.exec(http(“loginPost”)
.post("/qp/ums/v1/login?apiKey=qwerty")
.headers(headers_1)
//Passing deviceid from the csv file here****************************** This is not working. If I pass the string directly here, it works
.body(StringBody("""{“userName”:"${userName}",“password”:“Welcome1@”,“lDevice”:{“name”:“webClient”,“type”:“webClient”,“deviceId”:${deviceId}}}"""))
)
Thanks,
Kavya