correlation in gatling

1,698 views
Skip to first unread message

vikas joshi

unread,
Nov 17, 2014, 9:27:38 AM11/17/14
to gat...@googlegroups.com

I am using Gatling tool for recording script. i completed the recording part. but after saving that script i am not able to correated the dynamic values. because i not able to find any coding, as we have a viewer in JMeter from where i can find the left and right boundaries and proceed further.... so please help me

I have only below code i only able to do parametrization.

import io.gatling.core.Predef._
import io.gatling.core.session.Expression
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
import io.gatling.http.Headers.Names._
import io.gatling.http.Headers.Values._
import scala.concurrent.duration._
import bootstrap._
import assertions._

class web_tour_2 extends Simulation {

    val httpProtocol = http
        .baseURL("http://127.0.0.1:1080")
        .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; rv:33.0) Gecko/20100101 Firefox/33.0")

    val headers_3 = Map("""Content-Type""" -> """application/x-www-form-urlencoded""")

    val scn = scenario("Scenario Name")
        //home
        .exec(http("request_1")
            .get("""/cgi-bin/welcome.pl?signOff=true"""))
        .pause(100 milliseconds)
        .exec(http("request_2")
            .get("""/cgi-bin/nav.pl?in=home"""))
        .pause(20)
        //login
        .feed(csv("login.csv"))
        .exec(http("request_3")
            .post("""/cgi-bin/login.pl""")
            .headers(headers_3)
            .param("""userSession""", """114718.724260834fQAAittpDHQVzzzHDftAfpAzzcHf""")
            .param("""username""", """${username}""")
            .param("""password""", """${password}"""))
            .param("""login.x""", """0""")
            .param("""login.y""", """0""")
            .param("""JSFormSubmit""", """off"""))
        .pause(120 milliseconds)
        .exec(http("request_4")
            .get("""/cgi-bin/nav.pl?page=menu&in=home"""))
        .pause(20 milliseconds)
        .exec(http("request_5")
            .get("""/cgi-bin/login.pl?intro=true"""))
        .pause(7)
        //flight
        .exec(http("request_6")
            .get("""/cgi-bin/welcome.pl?page=search"""))
        .pause(90 milliseconds)
        .exec(http("request_7")
            .get("""/cgi-bin/nav.pl?page=menu&in=flights"""))
        .pause(90 milliseconds)
        .exec(http("request_8")
            .get("""/cgi-bin/reservations.pl?page=welcome"""))
        .pause(17)
        //continue
        .exec(http("request_9")
            .post("""/cgi-bin/reservations.pl""")
            .headers(headers_3)
            .param("""advanceDiscount""", """0""")
            .param("""depart""", """Denver""")
            .param("""departDate""", """11/18/2014""")
            .param("""arrive""", """London""")
            .param("""returnDate""", """11/19/2014""")
            .param("""numPassengers""", """1""")
            .param("""seatPref""", """Aisle""")
            .param("""seatType""", """Business""")
            .param("""findFlights.x""", """36""")
            .param("""findFlights.y""", """16""")
            .param(""".cgifields""", """roundtrip""")
            .param(""".cgifields""", """seatType""")
            .param(""".cgifields""", """seatPref"""))
        .pause(13)
        //continue2
        .exec(http("request_10")
            .post("""/cgi-bin/reservations.pl""")
            .headers(headers_3)
            .param("""outboundFlight""", """021;437;11/18/2014""")
            .param("""numPassengers""", """1""")
            .param("""advanceDiscount""", """0""")
            .param("""seatType""", """Business""")
            .param("""seatPref""", """Aisle""")
            .param("""reserveFlights.x""", """23""")
            .param("""reserveFlights.y""", """10"""))
        .pause(13)
        //continue3
        .exec(http("request_11")
            .post("""/cgi-bin/reservations.pl""")
            .headers(headers_3)
            .param("""firstName""", """${username}""")
            .param("""lastName""", """${password}""")
            .param("""address1""", """hdfgh""")
            .param("""address2""", """5765675""")
            .param("""pass1""", """${username} ${password}""")
            .param("""creditCard""", """23gf567""")
            .param("""expDate""", """12/15""")
            .param("""saveCC""", """on""")
            .param("""oldCCOption""", """on""")
            .param("""numPassengers""", """1""")
            .param("""seatType""", """Business""")
            .param("""seatPref""", """Aisle""")
            .param("""outboundFlight""", """021;437;11/18/2014""")
            .param("""advanceDiscount""", """0""")
            .param("""returnFlight""", """""")
            .param("""JSFormSubmit""", """off""")
            .param("""buyFlights.x""", """51""")
            .param("""buyFlights.y""", """8""")
            .param(""".cgifields""", """saveCC"""))
        .pause(14)
        //logout
        .exec(http("request_12")
            .get("""/cgi-bin/welcome.pl?signOff=1"""))
        .pause(70 milliseconds)
        .exec(http("request_13")
            .get("""/cgi-bin/nav.pl?in=home"""))

   


John Arrowwood

unread,
Nov 20, 2014, 1:07:30 PM11/20/14
to gat...@googlegroups.com
What's the question?

vikas joshi

unread,
Nov 20, 2014, 1:38:44 PM11/20/14
to gat...@googlegroups.com

Question is that in gatling how we do coorelation without knowing the boundaries???
Or if finding boundaries is possible than how????

Plese answer me with full flow because i m new in gatling...

--
You received this message because you are subscribed to a topic in the Google Groups "Gatling User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gatling/j-8OwSL3GrY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Arrowwood

unread,
Nov 20, 2014, 2:13:33 PM11/20/14
to gat...@googlegroups.com
I'm sorry, but in order to help you, you are going to have to be more specific.  How would you do correlation if you DO know the boundaries?  Is your question, "how do you do correlation?"  Or is your question "How do you get the boundaries?"

vikas joshi

unread,
Nov 20, 2014, 9:50:42 PM11/20/14
to gat...@googlegroups.com

How i get boundaries????
Means from where????

John Arrowwood

unread,
Nov 20, 2014, 10:13:22 PM11/20/14
to gat...@googlegroups.com
What "boundaries" are you talking about?  You know more about your application and what you are trying to do than any of us do.  You are going to have to be more explicit about what you are trying to do if you expect us to be able to help you.

vikas joshi

unread,
Nov 20, 2014, 10:32:22 PM11/20/14
to gat...@googlegroups.com
hi John,
           If you are familiar with JMeter you know that there we have response and request body viewer  also from where we take the "boundaries".
but here in Gatling we have only the scala code after stoping the recording process as i post my code in this group.

in My code session id which i need to be correlate so help me out how i correlate this value?

i think now i am clear. 
vikas joshi

John Arrowwood

unread,
Nov 20, 2014, 10:36:07 PM11/20/14
to gat...@googlegroups.com
It's been a LONG time since I did much with JMeter.  So no, I am not familiar with the "boundaries" you are talking about.  But if you can explain what they are, I bet we will be able to answer your question.
John Arrowwood,
Consulting Hypnotist / Hypnotherapist
http://www.JohnArrowwood.com
503.863.4823

vikas joshi

unread,
Nov 20, 2014, 10:39:36 PM11/20/14
to gat...@googlegroups.com
Highlighted value is need to be correlated...
--
vikas joshi

User_session to be correlate.PNG

vikas joshi

unread,
Nov 20, 2014, 11:06:05 PM11/20/14
to gat...@googlegroups.com
Left Boundary =>   EVENTVALIDATION" value="   

Right Boundary=>    "

Regular Expression =>  EVENTVALIDATION\" value=\"(.*?)\"


I Think you Now you get..
--
vikas joshi

JMeter coorelation.PNG
EventValidation.PNG

John Arrowwood

unread,
Nov 21, 2014, 12:49:57 PM11/21/14
to gat...@googlegroups.com
No, I still don't get it.  Read the definition of the word "correlation": http://dictionary.reference.com/browse/correlation

It looks like you are trying to EXTRACT information.  If that is the case, the answer to your question should be here:  http://gatling.io/docs/2.0.3/http/http_check.html

Sana Herekar

unread,
May 7, 2018, 2:03:32 AM5/7/18
to Gatling User Group
Hi Vikas,

Did you get the solution to this? If yes, plz do share it with me since I am new to gatling and unable to find the solution on how to do correlation in gatling. Your reply will be a great help to me.

Thanks,
Sana

Håkan

unread,
May 9, 2018, 5:25:06 AM5/9/18
to Gatling User Group
Read up on the documentation on HTTP Checks: https://gatling.io/docs/current/http/http_check/

Basically, you would do something like this:

.check(
status.is(201),
headerRegex("Location", "\\/tickets\\/(.+)").ofType[String].saveAs("myParam")
)

Replace the headerRegex part with the type of check that suits your needs, then you can use ${myParam} in subsequent requests.

Meenakshi Nallavalli

unread,
May 9, 2018, 3:38:45 PM5/9/18
to Gatling User Group
Hello Vikas,


I am very new to Gatling tool and I don't know much of scala too. Could you please provide a view of correlated script in Gatling just like how you did in Jmeter screen shots.


Thank you in advance.

David Luu

unread,
May 9, 2018, 3:57:13 PM5/9/18
to Gatling User Group
Btw, this discussion thread, at least with respect to correlation, reminds me of a discussion topic a while back that for me brought up a different interpretation to the meaning of "correlation".


The meaning there, it seems to some in the (load/performance testing) industry, is more about automatic translation/parsing of test parameters like HTTP query strings and HTTP form POST parameters, where instead of doing all the work manually (regex, xpath, string parsing/extract by a human), the test tool itself does some or all of that inference for you. It seems to be more a specialty feature in commercial test tools than open source ones.

Perhaps the OP is referring to more of that type of correlation here.

Meenakshi Nallavalli

unread,
May 10, 2018, 8:31:43 AM5/10/18
to Gatling User Group
David Luu,

Thank you for explaning I really apprecitate that and offcourse I am really good at using Jmeter and LoadRunner tools from past 7 years but I am trying to learn Gatling when I going through the documentation I have hard time to understand that's the reason I did asked for some sample script for doing correlation in Gatling.



vikas joshi

unread,
May 12, 2018, 2:00:06 PM5/12/18
to Gatling User Group
Hi @Sana @Meenakshi,

I am not sure that till now you received any solution for correlation in Gatling or not!
As when i started to search solution for that I tried from my side a lot but didn't get any proper solution, So moved to JMeter only.
Now if you guys find any solution, share over here also.

Thanks

Meenakshi Nallavalli

unread,
May 14, 2018, 8:38:05 AM5/14/18
to Gatling User Group
Hello @Vikas,


So far I couldn't find any solution and as I did mentioned documenation is not helping me much but I will post for sure if I find out solution.

Sana Herekar

unread,
May 14, 2018, 11:05:04 AM5/14/18
to gat...@googlegroups.com
Hi guys,

Same here with me. Even I couldnt find any solution for "How to do correlation " in gatling. Didnt find any solution from the document.

If anyone knows the solution plz do share. It will be great help.

Regards,
Sana

On Mon, May 14, 2018, 6:08 PM Meenakshi Nallavalli <meenakshi....@gmail.com> wrote:
Hello @Vikas,


So far I couldn't find any solution and as I did mentioned documenation is not helping me much but I will post for sure if I find out solution.

--
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.
Message has been deleted

David Luu

unread,
May 14, 2018, 4:16:34 PM5/14/18
to Gatling User Group
Reply all
Reply to author
Forward
0 new messages