I’m not really an experienced programmer. I’m in my first internship, and I’m experimenting with gatling (basically I’m the only person doing gatling at this company so I can’t ask anyone else). My question is, when I’m doing a check, can I check the status when logging in from a feed and if the status is wrong can I get the feeds username so I know which ones are failing?
I just realized that by doing ${username} in the print statement of the conditional, it probably moves on to the next username and prints it out instead of printing out the right one… I just need someone to tell me how to do what I want to do because I feel like I have no idea what I’m doing.
Let me actually explain the problem. So, I have 80,000 users or so in a csv file, and some of them have wrong passwords and right passwords (I’m still trying to figure out a way to maybe randomly feed wrong passwords from one csv file and right ones from the other csv file). My boss wants me to test both logging in sucesses and failures. But before I figure that out, I need to know how to print information. I probably wouldn’t print much for 80,000 users, but for smaller amounts definitely. Just so I could know which user is being entered in. Also it would be beneficial for other information later on.
I’m reading over the extraInfoExtractor and I’m not really understanding what I should be entering in as the parameters? I got this from doing a little bit of searching the group
But as I said, I’m a noob. I’m not really getting the parameters.
Status: As in a HTTP status code? If that is the case, can I make it any status code? I really want to use this for every situation…
Session: ???
Request: .exec(http(“REQUEST_NAME”). So the “REQUEST_NAME” is what I should enter.
Response: ???
Sessions were actually another thing I was looking at.
You’d probably feel more comfortable with an IDE so that you can explore types and Gatling DSL.
You can also explore on Github (tip: type T and then the name of the file you’re looking for)
In cases like this: What you really want to do is to generate a new CSV file with the same format as the input data during the test, so that you can immediately import that into a spreadsheet and/or hand that data back to your loadtest.
So you don’t want to print just the failed users. You want to print all of them.
Easiest way to do that in loadrunner is to print/log a line for every login, listing the username, password (if needed/applicable), and login result (pass/fail), in comma seperated format, and then simply use a grep over the final set of vuser logs (you get one file per virtual user in loadrunner) to put the end result together.
Usually that file is then used to
feed good users to the loadtest
and
put together a spreadsheet for the people responsible for the test data in question, so that the problems can be fixed.
( I’ve also seen scripts where ‘fixing it’ is actually done dynamically by the loadtest script itself, simply by hitting a settings page in the application every time we come across a ‘bad’ user.
That distorts the load a little but … either it doesn’t happen enough to cause a real problem, or it happens too often and then fixing it is the right thing to do anyway, even if the test itself is a loss. )
Ok cool. Finally ran without errors. I set it up like this:
val httpProtocol = http
.baseURL(“http://localhost:8080”)
.extraInfoExtractor((status, session, _, _) => status match {
case KO => List(session(“username”).as[String])
case _ => Nil
})
…
…
It seems to work, but when I check my simulation.log file, there’s nothing relevant in the file?