PloniStacker
PloniStacker

Reputation: 666

How can I make check()....findAll.Save not mandatory in Gatling?

I am paginating through different pages and saving values in the following manner:

.check(jsonPath("$.values[?(@.value == 'Some value')].VALUE").findAll.saveAs("value"))

Some pages dont have the values that I am looking for and this is a completely legit scenario. The problem is that if I cant find the value, the transaction fails.

Is there any way to save a jsonpath value to session without .check or in a way that if it's not found than its not failing the transaction and just continue with the flow?

Upvotes: 0

Views: 729

Answers (1)

James Warr
James Warr

Reputation: 2604

Yep - the gatling DSL supports exactly this scenario

.check(jsonPath("$.values[?(@.value == 'Some value')].VALUE").findAll.optional.saveAs("value"))

Upvotes: 2

Related Questions