Hello all,
This is my third attempt at posting this question. I have a test I have been working on and I wanted to utilize a feeder file to simulate user inputs. I’ve tried putting the declaration and call of the feeder file in many different places in my code. I put the declaration inside the object, outside the object but in the class, down by the scenario declaration, and I’ve placed the call in the scenario declaration and in the object. Not sure where else I might have to put it. Here is the code I’ve used:
object AddUser{
val feeder = csv(“UserFeeder.csv”).random
val addUser = feed(feeder)
.exec(http(“Add_User”)
.post("/Path/to/URI/")
.body(StringBody("""{“action”:“ADDUSER”,
“session”:"${currentSession}",
“username”:"${username}",
“password”:“somePassword”,
“fullname”:"${fullname}",
“email”:"${email}"
}"""))
.transformResponse{
case response if response.isReceived =>
new ResponseWrapper(response) {
val stripped = response.body.string
println("### stripped = " + stripped)
override val body = new StringResponseBody(stripped, response.charset)
}
}
.asJSON
.check(jsonPath("$.result").is(“true”))
.check(status.is(200))
.extraInfoExtractor(ExtraInfo => {
if(ExtraInfo.status==“KO”)
println("httpCode: " + ExtraInfo.response.statusCode + ", Response: " + ExtraInfo.response.body)
List(ExtraInfo.response.statusCode, ExtraInfo.response.body.string)}))
}
I have also thought that maybe the location of the feeder file might have been the problem. I placed it originally in the data folder within the user-files folder. I have also tried it in the simulations folder with the script. When I try to run the test, no report is created and it basically appears to fail, but the test begins to run and closes out nearly immediately. I also attempted to see if the Advanced Simulation that came with the Gatling program would work (the one that requires the feeder file) and this provided the same results.
Anyone have any idea what is going on with this? Thank you in advance for your help.
Rob