Okay, I've got another feeder/http POST body question. Thank you for all of your help so far - Gatling is an awesome tool, and I feel like I'm so close to getting it to work for our project.
I'm continuing to work on my registration load test, and now I'm running into the following issue when attempting to use a feeder to generate my JSON POST body - some lines don't seem to be correctly handling double quotes in my CSV file. (Of three requests, one worked, two mysteriously didn't.)
Relevant script pieces:
val userData = csv("test.csv").queue
val scn = scenario("Register user")
.feed(userData)
.exec(
http("POST registration")
.post("/user/register")
.headers(headers_1)
.body(StringBody("""{"username":${username}, "email":${email}, "imei":${imei}, "gcmId":${gcmId}, "age":${age},"albumSelection":${albumSelection},"latitude":${latitude},"longitude":${longitude},"emailOptIn":${emailOptIn},"termsOptIn":${termsOptIn} }""")))
My CSV file looks like this:
username,emailOptIn,albumSelection,termsOptIn,age,gcmId,longitude,latitude,imei,email
It seems like everything is correct there, but when I run with logging turned on, I see the following messages:
Session:
Session(Register user,1,Map(latitude -> 65, email -> "tester73...@mailinator.com", username -> tester7317165156", imei -> "999997317165156", age -> "59", longitude -> 176, termsOptIn -> true, emailOptIn -> true, gcmId -> "7317165156", albumSelection -> "clean"),1382385464346,0,List(),List(KO),List(),List()) =========================
HTTP request:
headers=
Content-Type: [application/JSON]
stringData={"username":tester7317165156", "email":"tester73...@mailinator.com", "imei":"999997317165156", "gcmId":"7317165156", "age":"59","albumSelection":"clean","latitude":65,"longitude":176,"emailOptIn":true,"termsOptIn":true }
Session:
Session(Register user,2,Map(latitude -> -82, email -> "tester62...@mailinator.com", username -> tester6271383680", imei -> "999996271383680", age -> "37", longitude -> -42, termsOptIn -> true, emailOptIn -> true, gcmId -> "6271383680", albumSelection -> "explicit"),1382385464346,0,List(),List(KO),List(),List()) =========================
HTTP request:
headers=
Content-Type: [application/JSON]
stringData={"username":tester6271383680", "email":"tester62...@mailinator.com", "imei":"999996271383680", "gcmId":"6271383680", "age":"37","albumSelection":"explicit","latitude":-82,"longitude":-42,"emailOptIn":true,"termsOptIn":true }
Session:
Session(Register user,0,Map(latitude -> 45, email -> "
tester71...@mailinator.com", username -> "tester7105408553", imei -> "999997105408553", age -> "62", longitude -> 0, termsOptIn -> false, emailOptIn -> true, gcmId -> "7105408553", albumSelection -> "clean"),1382385464345,0,List(),List(OK),List(),List())
=========================
HTTP request:
headers=
Content-Type: [application/JSON]
stringData={"username":"tester7105408553", "email":"tester71...@mailinator.com", "imei":"999997105408553", "gcmId":"7105408553", "age":"62","albumSelection":"clean","latitude":45,"longitude":0,"emailOptIn":true,"termsOptIn":false }I don't understand why this is only sometimes failing. The first two requests are not correctly placing the first quote on the username in the JSON, and are (correctly) getting a 500 error from the server, the last one is, and (correctly) registers the user.
Any thoughts or suggestions are much appreciated.
Thanks,
Hank