Multiple checks on the same http response

Hi,

i’m new to both scala and gatling.

What’s the proper way to chain multiple checks on the same response in order to build the next http call ?

On the scn_scenario.txt example you are doing

.exec(
http(“request_4”)
.get("/private/bank/accounts.html")
.headers(headers_4)
.check(regex(""“ACC(\d+)”"").find.saveAs(“account_id”))
)
.pause(7, 8)
.exec(
http(“request_5”)
.get("/private/bank/account/ACC${account_id}/operations.html")
.headers(headers_5)
)

But for some of my pages i have to retrieve multiple values from the first page in order to build the second one, so i’d like to call multiple time the check. Something like

.exec(
http(“request_4”)
.get("/private/bank/accounts.html")
.headers(headers_4)
.check(regex(""“ACC(\d+)”"").find.saveAs(“account_id”))
.check(regex(""“DEP(\d+)”"").find.saveAs(“dep_id”))
)
.pause(7, 8)
.exec(
http(“request_5”)
.get("/private/bank/account/ACC${account_id}/DEP${dep_id}/operations.html")
.headers(headers_5)
)

Hi,

The check method actually takes a vararg argument, so you only have to call it once :
.exec(
http(“request_4”)
.get("/private/bank/accounts.html")
.headers(headers_4)
.check(regex(""“ACC(\d+)”"").find.saveAs(“account_id”),
regex(""“DEP(\d+)”"").find.saveAs(“dep_id”)
)
)

What happens is that all the elements are immutable, and when you call check a second time, you actually overwrite what you had set the first time.
In a future version, we won’t let user call check twice. I’ve already opened an issue this morning : https://github.com/excilys/gatling/issues/397

Sincerely,

Stephane

2012/2/6 mediamana <mediamana@free.fr>

it works like a charm

thanks for the quick reply

No problem.
Just to let you know, I’ve pushed the fix and it will be in the next 1.1 release.

2012/2/6 mediamana <mediamana@free.fr>

Hi!

I’ve added documentation for that here : https://github.com/excilys/gatling/wiki/Advanced-Usage

Cheers,
BluePyth