|
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.<br>import io.gatling.core.Predef._<br>import io.gatling.core.session.Expression<br>import io.gatling.http.Predef._<br>import io.gatling.jdbc.Predef._<br>import io.gatling.http.Headers.Names._<br>import io.gatling.http.Headers.Values._<br>import scala.concurrent.duration._<br>import bootstrap._<br>import assertions._<br><br>class web_tour_2 extends Simulation {<br><br> val httpProtocol = http<br> .baseURL("http://127.0.0.1:1080")<br> .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")<br> .acceptEncodingHeader("gzip, deflate")<br> .acceptLanguageHeader("en-US,en;q=0.5")<br> .connection("keep-alive")<br> .userAgentHeader("Mozilla/5.0 (Windows NT 6.1; rv:33.0) Gecko/20100101 Firefox/33.0")<br><br> val headers_3 = Map("""Content-Type""" -> """application/x-www-form-urlencoded""")<br><br> val scn = scenario("Scenario Name")<br> //home<br> .exec(http("request_1")<br> .get("""/cgi-bin/welcome.pl?signOff=true"""))<br> .pause(100 milliseconds)<br> .exec(http("request_2")<br> .get("""/cgi-bin/nav.pl?in=home"""))<br> .pause(20)<br> //login<br> .feed(csv("login.csv"))<br> .exec(http("request_3")<br> .post("""/cgi-bin/login.pl""")<br> .headers(headers_3)<br> .param("""userSession""", """114718.724260834fQAAittpDHQVzzzHDftAfpAzzcHf""")<br> .param("""username""", """${username}""")<br> .param("""password""", """${password}"""))<br> .param("""login.x""", """0""")<br> .param("""login.y""", """0""")<br> .param("""JSFormSubmit""", """off"""))<br> .pause(120 milliseconds)<br> .exec(http("request_4")<br> .get("""/cgi-bin/nav.pl?page=menu&in=home"""))<br> .pause(20 milliseconds)<br> .exec(http("request_5")<br> .get("""/cgi-bin/login.pl?intro=true"""))<br> .pause(7)<br> //flight<br> .exec(http("request_6")<br> .get("""/cgi-bin/welcome.pl?page=search"""))<br> .pause(90 milliseconds)<br> .exec(http("request_7")<br> .get("""/cgi-bin/nav.pl?page=menu&in=flights"""))<br> .pause(90 milliseconds)<br> .exec(http("request_8")<br> .get("""/cgi-bin/reservations.pl?page=welcome"""))<br> .pause(17)<br> //continue<br> .exec(http("request_9")<br> .post("""/cgi-bin/reservations.pl""")<br> .headers(headers_3)<br> .param("""advanceDiscount""", """0""")<br> .param("""depart""", """Denver""")<br> .param("""departDate""", """11/18/2014""")<br> .param("""arrive""", """London""")<br> .param("""returnDate""", """11/19/2014""")<br> .param("""numPassengers""", """1""")<br> .param("""seatPref""", """Aisle""")<br> .param("""seatType""", """Business""")<br> .param("""findFlights.x""", """36""")<br> .param("""findFlights.y""", """16""")<br> .param(""".cgifields""", """roundtrip""")<br> .param(""".cgifields""", """seatType""")<br> .param(""".cgifields""", """seatPref"""))<br> .pause(13)<br> //continue2<br> .exec(http("request_10")<br> .post("""/cgi-bin/reservations.pl""")<br> .headers(headers_3)<br> .param("""outboundFlight""", """021;437;11/18/2014""")<br> .param("""numPassengers""", """1""")<br> .param("""advanceDiscount""", """0""")<br> .param("""seatType""", """Business""")<br> .param("""seatPref""", """Aisle""")<br> .param("""reserveFlights.x""", """23""")<br> .param("""reserveFlights.y""", """10"""))<br> .pause(13)<br> //continue3<br> .exec(http("request_11")<br> .post("""/cgi-bin/reservations.pl""")<br> .headers(headers_3)<br> .param("""firstName""", """${username}""")<br> .param("""lastName""", """${password}""")<br> .param("""address1""", """hdfgh""")<br> .param("""address2""", """5765675""")<br> .param("""pass1""", """${username} ${password}""")<br> .param("""creditCard""", """23gf567""")<br> .param("""expDate""", """12/15""")<br> .param("""saveCC""", """on""")<br> .param("""oldCCOption""", """on""")<br> .param("""numPassengers""", """1""")<br> .param("""seatType""", """Business""")<br> .param("""seatPref""", """Aisle""")<br> .param("""outboundFlight""", """021;437;11/18/2014""")<br> .param("""advanceDiscount""", """0""")<br> .param("""returnFlight""", """""")<br> .param("""JSFormSubmit""", """off""")<br> .param("""buyFlights.x""", """51""")<br> .param("""buyFlights.y""", """8""")<br> .param(""".cgifields""", """saveCC"""))<br> .pause(14)<br> //logout<br> .exec(http("request_12")<br> .get("""/cgi-bin/welcome.pl?signOff=1"""))<br> .pause(70 milliseconds)<br> .exec(http("request_13")<br> .get("""/cgi-bin/nav.pl?in=home"""))<br><br> <br>
|
What’s the question?
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…
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?”
How i get boundaries???
Means from where???
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.
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.
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.
Highlighted value is need to be correlated…
Left Boundary => EVENTVALIDATION" value="
Right Boundary=> "
Regular Expression => EVENTVALIDATION" value="(.*?)"
I Think you Now you get…
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
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
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.
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.
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”.
http://alexanderpodelko.com/blog/2017/08/15/the-role-of-recording-in-load-testing-tools/
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.
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.
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
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.
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
There does seem to be less article for correlation with gatling, I did a quick search. Perhaps these might help at least:
https://www.youtube.com/watch?v=nSYW5LOn7Gw
https://stackoverflow.com/questions/36792317/correlation-of-dynamic-value-in-gatling
https://stackoverflow.com/questions/18351476/how-to-get-ticket-in-gatling-using-correlation