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
.baseURL(“https://zsousa-vm:443”)
.acceptHeader(“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”)
.acceptEncodingHeader(“gzip, deflate”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.connection(“keep-alive”)
.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”)
.exec(http(“getLoginPage”)
.get("/")
)
.pause(10)
.exec(http(“SubmitLogin”)
.post("/sys/login.php")
.headers(headers_2)
.param(""“username”"", “”“123456"”")
.param(""“password”"", “”“1"”")
.param(""“ajaxLogin”"", “”“1"”")
)
.pause(900 milliseconds)
.exec(http(“request_3”)
.get("/system/")
)
.pause(10)
.exec(http(“EnterData”)
.post("/system/enterData.php")
.headers(headers_4)
.param(""“miles”"", “”“222"”")
.param(""“month”"", “”“201305"”")
.param(""“odometer_reading”"", “”“333333"”")
.param(""“save_current”"", “”“Submit May 2013 business miles”"")
.param(""“last_daily_odometer”"", “”"""")
)
.pause(10)
.exec(http(“ConfirmEnterData”)
.post("/system/enterData.php")
.headers(headers_4)
.param(""“month”"", “”“201305"”")
.param(""“confirm_current”"", “”“1"”")
)
.pause(5)
.exec(http(“Logout”)
.get("/sys/logout.php")
)
setUp(scn.users(1).protocolConfig(httpConf))
}