How to run "Login Scenario" on ADF web App

406 views
Skip to first unread message

Shahab Etminan

unread,
Jan 4, 2015, 6:23:19 AM1/4/15
to gat...@googlegroups.com
Hi,

 I'm trying to run the following scenario on an Oracle ADF web App

It's only the login form of the App but it fails when I run the scenarion

this line seems suspicious to me :

.get(uri1 + "/security/pages/Login.jspx?_afrLoop=1805190504273000&_afrWindowMode=0&_afrWindowId=15ju479l2n_1")))

Any hints would  be appreciated.





package pooya.intl.test.login

import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
import io.gatling.core.check.SaveAs
import io.gatling.core.check.SaveAs
import io.gatling.http.response.ResponseBody

class MyLogin extends Simulation {

  val httpProtocol
= http
 
   
.baseURL("http://127.0.0.1:7101")
   
.inferHtmlResources()
   
.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:34.0) Gecko/20100101 Firefox/34.0")
   
.disableResponseChunksDiscarding

  val uri1
= "http://127.0.0.1:7101/intl/faces"

  val scn
= scenario("MyLogin")
   
.exec(http("request_0")
     
.get("/intl/faces/security/pages/Login.jspx")
     
.resources(http("request_1")
       
.get(uri1 + "/security/pages/Login.jspx?_afrLoop=1805190504273000&_afrWindowMode=0&_afrWindowId=15ju479l2n_1")))

   
.pause(2)
   
.exec(http("request_2")
     
.post("/intl/faces/security/pages/Login.jspx?_adf.ctrl-state=17w9barjex_19")
     
.formParam("pt:username", "admin")
     
.formParam("pt:password", "123456")
     
.formParam("org.apache.myfaces.trinidad.faces.FORM", "dataForm")
     
.formParam("javax.faces.ViewState", "!-5zyl39i6n")
     
.formParam("event", "pt:login")
     
.formParam("event.pt:login", """<m xmlns="http://oracle.com/richClient/comm"><k v="type"><s>action</s></k></m>""")
     
.resources(http("request_3")
       
.get(uri1 + "/settingjavascriptservlet.js"),
        http
("request_4")
         
.get(uri1 + "/jheadstart/images/go_ena.png")
         
.check(status.is(304)),
        http
("request_5")
         
.get(uri1 + "/favicon.ico")
         
.check(status.is(304))))

  setUp
(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
}




Shahab Etminan

unread,
Jan 4, 2015, 6:33:14 AM1/4/15
to gat...@googlegroups.com
I get the following error in the ADF app Log :
<AdfcExceptionHandler> <handleException> ADFc: While handling an exception the application's exception handler threw a new exception.
javax.faces.application.ViewExpiredException: viewId:/security/pages/Login.jspx - ADF_FACES-30107:The view state of the page has expired.  Reload the page.


Stéphane Landelle

unread,
Jan 4, 2015, 6:45:31 AM1/4/15
to gat...@googlegroups.com
ADF is based on JSF, that uses tokens to synchronize browser view state and server state. You have to capture those tokens in the page and send them back properly. 

In .formParam("javax.faces.ViewState", "!-5zyl39i6n")

!-5zyl39i6n is not a constant that you can set once and for all.


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shahab Etminan

unread,
Jan 4, 2015, 7:12:25 AM1/4/15
to gat...@googlegroups.com
How can I capture that in a scenario ? can you please give me a sample code ? (I'm new to scala & gatling !)

That was a great help,Thank you.

Shahab Etminan

unread,
Jan 4, 2015, 7:22:41 AM1/4/15
to gat...@googlegroups.com
there are also following parameters then need to be set, these are specifically for   ADF.
How should I set these also ?!

_afrLoop= &_afrWindowMode= &_afrWindowId=

Abhinav Gogna

unread,
Jan 4, 2015, 10:47:41 AM1/4/15
to gat...@googlegroups.com
Shahab,

Usually you can capture data from response using checks. Depending upon how this information is in response body, you can either use regex parser or cssselector.
http://gatling.io/docs/2.1.2/http/http_check.html
 
Go through the gatling tutorial (quickstart and advanced). Stephane & co. has covered capturing these scenarios. Without a good understanding of the tool you will be lost.
http://gatling.io/docs/2.1.2/quickstart.html
Reply all
Reply to author
Forward
0 new messages