I had placed checks and want to same the output in a variable but seems something is not right, causing failure. it seems like the checks are executed prior to the http request. In my case I had a POST and Get request in same EXEC block. Anyone faced similar issue ?
.exec(http("FB_03_FeedbackSubmit")
.post("/data/forms/feedback-form/details")
.headers(headers_2)
.formParam("__RequestVerificationToken", "${token1}")
.formParam("MessageTypeSelected", "Get in touch")
.formParam("Subject", "Test_About: I want to send some chocolates for")
.formParam("ReferenceNumber", "Reference number is 223")
.formParam("Message", "test message")
.formParam("ReplyRequested", "True")
.formParam("FirstName", "James ")
.formParam("LastName", "Bond")
.formParam("ContactMethod", "Email")
.formParam("Email", "test@test.com")
.check(status.is(200))
.check(jsonPath("$..title").is("success"))
.resources(http("request_3")
.get("/data/forms/feedback-form/confirmation")
.headers(headers_3)
.check(status.is(200))
.check(regex("""<h3>Your reference number is "(.*)" />""").saveAs("FBNum"))
.check(css("h3").transform((s: String) => s.indexOf("Your reference number is ")).greaterThan(-1))
)
)
.pause(3)
In the log I see:
Request DefaultFullHttpRequest(decodeResult: success, version: HTTP/1.1, content: EmptyByteBufBE)
GET /data/forms/feedback-form/confirmation HTTP/1.1
Accept: /
Accept-Language: en-US,en;q=0.8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
X-Requested-With: XMLHttpRequest
Referer: https://test.com/contact/feedback-form
Cookie: __RequestVerificationToken=token_jVlNBJApNgao5kx1z0u7ZRmtkJQIUH22fRbRs1bwMDgC4MX964V92ACUyioRTiL-cUFNe7MIMbizvoZ90P5m7jQ2; SC_ANALYTICS_GLOBAL_COOKIE=1b442c5c60b345c989c0b8f31719e576|False; ASP.NET_SessionId=2llg3nlmr5bdpuexi0o430qr
Host: test.com
Response DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Content-Type: text/html; charset=utf-8
Expires: -1
Vary: Accept-Encoding
Server: Microsoft-IIS/8.5
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1
Transfer-Encoding: chunked
Content-Encoding: gzip
10:02:58.018 [WARN ] i.g.h.a.ResponseProcessor - Request ‘request_3’ failed: regex(
Your reference number is “(.*)” />).find.exists, found nothing
10:02:58.023 [TRACE] i.g.h.a.ResponseProcessor -
Request:
request_3: KO regex(Your reference number is “(.*)” />).find.exists, found nothing
Session:
Session(perf-FB,1,Map(token1 → 95kGp3x4tohAcFSxHzuAysA18lbiACeEMIBn5W3MmmILt9Th22a40dYVSnuhbtm_WyMo11I0b8hip1oTbHonlHQUGpahzFEdilY6VH5A2V7sZFHOrezyQ4zc1XOfUp3VLhSUOM5m5OM2b9Ge4rH68Q2, gatling.http.cache.dns → io.gatling.http.resolver.ShuffleJdkNameResolver@77b059b, gatling.http.cache.contentCache → io.gatling.core.util.cache.Cache@2c0dd6b5, gatling.http.referer → https://test.com/contact/feedback-form, gatling.http.cookies → CookieJar(Map(CookieKey(asp.net_sessionid,test.com,/) → StoredCookie(ASP.NET_SessionId=2llg3nlmr5bdpuexi0o430qr; path=/; HTTPOnly,true,false,1503619242652), CookieKey(sc_analytics_global_cookie,test.com,/) → StoredCookie(SC_ANALYTICS_GLOBAL_COOKIE=1b442c5c60b345c989c0b8f31719e576|False; path=/; HTTPOnly,true,false,1503619366333), CookieKey(__requestverificationtoken,test.com,/) → StoredCookie(__RequestVerificationToken=token_jVlNBJApNgao5kx1z0u7ZRmtkJQIUH22fRbRs1bwMDgC4MX964V92ACUyioRTiL-cUFNe7MIMbizvoZ90P5m7jQ2; path=/; HTTPOnly,true,false,1503619366333)))),1503619237435,18,KO,List(),io.gatling.core.protocol.ProtocolComponentsRegistry$$Lambda$210/1445999733@405c8559)HTTP request:
GET https://test.com/data/forms/feedback-form/confirmation
headers=
Accept: /
Accept-Language: en-US,en;q=0.8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
X-Requested-With: XMLHttpRequest
Referer: https://test.com/contact/feedback-form
Cookie: __RequestVerificationToken=token_jVlNBJApNgao5kx1z0u7ZRmtkJQIUH22fRbRs1bwMDgC4MX964V92ACUyioRTiL-cUFNe7MIMbizvoZ90P5m7jQ2; SC_ANALYTICS_GLOBAL_COOKIE=1b442c5c60b345c989c0b8f31719e576|False; ASP.NET_SessionId=2llg3nlmr5bdpuexi0o430qr
Host: test.comHTTP response:
status=
200 OK
headers=
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Content-Type: text/html; charset=utf-8
Expires: -1
Vary: Accept-Encoding
Server: Microsoft-IIS/8.5
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1
Date: Fri, 25 Aug 2017 00:02:48 GMT
Transfer-Encoding: chunked
Content-Encoding: gzipbody=
Thanks James
Your reference number is ABC123
We've received your enquiry. We'll aim to get back to you within seven working days.
Use your reference number if you need to talk to us sooner at help@test.com or by calling 11 22 33.
10:02:58.291 [DEBUG] i.g.h.f.ResourceFetcherActor - Resource https://test.com/data/forms/feedback-form/confirmation was fetched
10:02:58.295 [DEBUG] i.g.h.f.ResourceFetcherActor - All resources were fetched
10:02:58.297 [INFO ] i.g.c.a.Pause - Pausing for 3000ms (real=2982ms)