Custom assertion using variable no longer working

Hello all,

We’re trying to upgrade to Gatling 2.1, but we run into an issue with custom assertions. We were using the following assertion to verify that the request count equals some variable that is updated during the test (externally by the system-under-test). This works because assert accepts a function that is invoked after the test has finished.

`
details(“test1”).allRequests.count.assert(value => value == myVariable, (name, result) => “…”),

`

In 2.1 .assert() has been replaced with conditions (is, between, etc…) which accept a val as parameter. These vals are read during setup, so it’s no longer possible to assert against a variable that is updated during the test.

The following doesn’t work, because myVariable is always zero:

`
details(“test1”).allRequests.count.is(myVariable)

`

Is there another way to accomplish this in 2.1?

Thanks.

Gijsbert

Hi,

Honestly, we didn’t anticipate assertions to be used in such a way (asserting against some value fetched from the sut once the load test is done).
That it was possible in 2.0 wasn’t intended.

In 2.1, we really wanted the run phase and the reporting phase to be decoupled. As a consequence, assertions are serialized and logged, so the reporting (reports can be re-generated with the -ro option) doesn’t have to be aware of the simulation (where the assertions originale).
We chose to serialize at the beginning of the run, instead of the end, so we can in a next version log the assertions in the reports, even the simulation was killed before ending normally. I’m not sure we’d be willing to give up on that so that you can have the old (unintended) behavior back.

Cheers,