Extractor

Hello,

Coming from the world of JMeter, I would like to apply an “extractor” on my http request, for 2 vars called _adf.ctrl-state and _afrLoop in the HTTP response body
Actually I’m defining my “extractor” with:

val adfCtrlStateCheck = regex("""_adf.ctrl-state=([-_0-9A-Za-z!]{10,13})""").saveAs(“adfCtrlState”)

val adfAfrLoopCheck = regex("""_afrLoop=([-_0-9A-Za-z]{13,17})""").saveAs(“adfAfrLoop”)

And then call them in the code :

http(name).get(url).check(jsfViewStateCheck)

My problem is that I use .check(), so if the regex is not a success, the test will stop (I assume).
How to apply a “best effort” ? (retrieve the var if it exists and do nothing if not)

I searched on the wiki but I did not find anything.

Thanks !

Mat

regex.saveAs is actually a shortcut for regex.find.exists.saveAs.
What you want is override “exists” with “whatever”: https://github.com/excilys/gatling/wiki/Checks#wiki-whatever

val adfCtrlStateCheck = regex("""_adf.ctrl-state=([-_0-9A-Za-z!]{10,13})""").whatever.saveAs(“adfCtrlState”)

val adfAfrLoopCheck = regex("""_afrLoop=([-_0-9A-Za-z]{13,17})""").whatever.saveAs(“adfAfrLoop”)

Cheers,

Stéphane

I will try whatever, Thanks !.

Cheers,

Mat