Multiple check problem

Hi guys,

I get a http request with different responses due to the webflow.

For example :

  • A search return a list of element (i got a regex “A” to validate response)
  • Another search return a list with only one element, in this case my webapp return the page of the element directly (i got a regex “B” to validate response)

My question is, how can i make a multiple check that verify only one of the two different regexp without getting a failed cheks when i run my simulation ?

Is it possible to get something like this ?
http("")…

.check( regex(myRegexA).saveAs(“aString”))
.check(regex(myRegexB).savsAs(“anotherString”)

Thanks byadvance,

Ludovic

Hi,

No, you can't have :
http("")...
.check( regex(myRegexA).saveAs("aString"))
.check(regex(myRegexB).saveAs("anotherString")

I shouldn't even compile.

We don't currently have something like a "OR" clause.

If you can have a condition on what to expect, you can use a doIf:
https://github.com/excilys/gatling/wiki/Scenario-Components#wiki-do-if

Otherwise, you'll probably have to write a custom check.
We're currently at the Mix-IT conference, so I can't explain how right
now...
Let me know if you need this custom check and I'll post a gist (maybe
tomorrow).

Cheers,

Steph

To solve my problem, i’m thinking about a new regex in the form below :

http("")…
.check( regex(A |B).saveAs(“aString”))

And then my original doIf on aString should work.

i’ll tell you if successed

Ludovic

Hello,

Just came back from hollidays and i tried the new “maybe” function this morning and all works as expected.

The final solution looks like below :

regex(""“exprA|exprB”"").maybe.saveAs(“myVariable”)

Very very nice job, thanks for your reactivity

Ludovic

Cool, thanks for the feedback.

However, I’m not very fond of the “maybe” keyword and I’m thinking of renaming it into “whatever” in 1.2.0.

Cheers,

Steph

2012/5/16 Ludovic Mercier <ludovic.mercier.lm@gmail.com>