Gatling scripts run with no errors, however when I look in the application under test I don't see any expected changes of mine

I created a Gatling script (using the recorder) to login my application to edit a text field and save. The script runs with no errors, but when I log into my application I don’t see any saved data.

package crsinc
import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
import com.excilys.ebi.gatling.jdbc.Predef._
import com.excilys.ebi.gatling.http.Headers.Names._
import akka.util.duration._
import bootstrap._
import assertions._

class SubmitMilesNML extends Simulation {

val httpConf = httpConfig
.acceptEncodingHeader(“gzip, deflate”)
.userAgentHeader(“Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0”)

val headers_2 = Map(
“Cache-Control” → “”“no-cache”"",
“Content-Type” → “”“application/x-www-form-urlencoded; charset=UTF-8"”",
“Pragma” → “”“no-cache”"",
“X-Requested-With” → “”“XMLHttpRequest”""

val headers_4 = Map(
“Content-Type” → “”“application/x-www-form-urlencoded”""

val scn = scenario(“SubmitMiles”)
.param(""“username”"", “”“123456"”")
.param(""“password”"", “”“1"”")
.param(""“ajaxLogin”"", “”“1"”")
.pause(900 milliseconds)
.param(""“miles”"", “”“222"”")
.param(""“month”"", “”“201305"”")
.param(""“odometer_reading”"", “”“333333"”")
.param(""“save_current”"", “”“Submit May 2013 business miles”"")
.param(""“last_daily_odometer”"", “”"""")
.param(""“month”"", “”“201305"”")
.param(""“confirm_current”"", “”“1"”")



It could be exactly the same problem you had before : since you don’t you use custom checks, if your application doesn’t use any specific HTTP status code in case of failure and just answers with a 200 OK, Gatling won’t consider it as failure.

For example, your login phase : you used the same URL to login in one of your previous messages on the list, when you had trouble identifying a login failure.
If the answer to a failed login phase is a 200 OK (instead of the “proper” HTTP status code to use, 401 Not Authorized), but with some message in the HTML page signifying that you failed to login, Gatling won’t automatically “read” the HTML page to look for “Bad login/password” (but you can tell Gatling to do it, using a check ;)).

Same thing if others pages doesn’t answer with a specific HTTP status code if you try to access them without begin logged, or if something went wrong when you’re trying to edit your data…

Gatling can do additional verification on the response to the HTTP request, but you have to tell it explicitly using a check, as the default check relies on the HTTP status code.

Without knowing the inner working of the application, I can’t know for sure if it’s the source of your problem, but it seems likely, since you had the same kind of problem a few days ago.



I added the check and that works fine, but this issue I am still having is that it doesn’t seem to be submitting the data.
my test is the following

  1. login to application under test
  2. enter values in two fields
  3. click on submit button
  4. Confirm submission

but when I login, the data was never submitted.

I used Firebug to look at the post information and it matches my script.

so I have no idea why this script runs and my check passes but the data is not submitted.

Could you provide the logs when you lower the level:

attached log file. Is this what you wanted? (261 KB)

No, if you uncomment some loggers in logback.xml, you’ll be able to see HTTP traffic in the console.
Either add a FileAppender or redirect console to a file.

attached fine the real log file you are looking for.

testFile.log (59.6 KB)

Here’s the problem I think: you’re trying to authenticate against https://server1:443/system/login.php but your system doesn’t accept it and permanently redirect to https://server1.company1.local/system/login.php and probably doesn’t log you in (should be 303 See Other, 302 Found is not exact but acceptable, but 301 is definitively wrong).

BTW, how does authentication work on your system? Cookies or maybe SSL tracking?

request was:
POST https://server1:443/system/login.php
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0
Accept-Language: en-US,en;q=0.5
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Encoding: gzip, deflate
password: 1
ajaxLogin: 1
username: 204881

I think your on to something. since I am getting redirected, my session id is changed.

I think we authenticate using cookies

any suggestions on how to resolve this?

I don’t know what your simulation look like.
Can’t you always target server1.company1.local?

it works!!! your advice helped!

Have fun!