Unable to Insert New Record in a form!

Hi every One,

I’m new to Gatling,So Please guide me through an step by step instructions!

I’m using gatling 2.1.1
What I’m trying to test is an ADF web Application.
I’ve recorded a scenario on login and then opening a simple form ,Adding a new Record (all of these steps in a single scenario)

The problem is ,when I execute the scenario (.scala file) no record is added to that form while I get No Error in final report.

Please tell me how is it possible to insert a new record in a web application’s form that needs Authentication, using gatling scenarios.

Thank you very much And Happy New Year

Hi
I’m not sure about ADF but in general you need to capture information from the scenario at run time using “check(…).saveAs(…)” and then look through your captured scenario and where the required fields are used (eg in URL’s or in form parameters or in POST bodies) and then extract the saved field from the session and insert it.

For example here is an example of putting some constants in the session (eg user name and password, although you could use feeders for this) and then logging on, ie POSTing to a .Net form that has a hidden Request verification token to prevent Cross-Site Request Forgery (CSRF) attacks. (see comments in the code for explanation)

object SimulationConstants {
val userName=“MickyMouse”
val userPass=“Disney”
}

//login chain
val mycahin = {
// add constants to the session for use in EL expressions later

exec(session => { session.set(“theUserName”, SimulationConstants.userName)})
.exec(session => { session.set(“theUserPass”, SimulationConstants.userPass)})

.exec(http(“request_0_homePage”)
.get("""/""")
.headers(headers_0)
// CAPTURE CSRF TOKEN on PAGE and Login FORM
.check( headerRegex(“Set-Cookie”, “”"__RequestVerificationToken=(.*?);""").saveAs(“reqVerCookieVal”) )
//NB using CSS selector to find form in page and grab the correct value
.check( css(“form#loginForm > input[name=__RequestVerificationToken]”, “value”).saveAs(“loginreqVerTok”) )
.pause(1)
//Uncomment following to See the captured variables
// .exec((s:Session) => {
// println("-------->>>>>>SEE CAPTURED TOKEN!!<<<<<< loginreqVerTok= " + s(“loginreqVerTok”).as[String]); s
// } )

//DO LOGIN
.exec(http(“request_1_Login”)
.post("""/Account/Login?returnUrl=/""")
.headers(headers_8)
//use the EL to use the captured values from the session
.formParam("""__RequestVerificationToken""", “”"${loginreqVerTok}""")
.formParam(""“UserName”"", “”"${theUserName}""")
.formParam(""“Password”"", “”"${theUserPass}""")
// capture returned page’s logout form’s CSRF token so I can logout cleanly later
.check( css(“form#logoutForm > input[name=__RequestVerificationToken]”, “value”).saveAs(“logoutreqVerTok”) )

}

A bit painful, but I hope it shows that you can do it. Unfortunately this is the kind of pain that Web site testers have to go through to mimic a web session.

Hope that helps

Cheers

Karl