You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to add some assertion in this someFunction to check, if percentage of successful requests (statusCode == 200) is not less than 10.
I've tried adding something like:
assert((successes*100)/allRequests >= 10))
But it does not fail the test scenario, when it's below that 10%.
I've tried using exitHereIfFailed or any of those types from Gatling documentation (but with no luck).
Moreover, I also added .assertions(forAll.failedRequests.count.is(0)) in setUp section. This also did not work (test is still ending with Build Successful).
I'm aware, there is also possibility to use an assertion for global requests (assertions(global.successfulRequests.percent.gt(10))), but I need my custom one.
Also I do not want to use any check, because counters (allRequests and successes) must be in request.during(<some time>) block.
Is there any option to use my custom counters and check percentage of successful request as in my example?
The text was updated successfully, but these errors were encountered:
domi-nika60
changed the title
HTTP - unable to create assertion in session exec
(Question / FeatureRequest) HTTP - unable to create assertion in session exec
Jan 24, 2022
serializable over the wire (hence use an AST, not arbitrary functions)
computed against Gatling metrics (not arbitrary ones you would compute manually)
In short, you would like Gatling to have custom metrics (counters, but others might want durations, often called timers) and that they support assertions.
That's something we're considering, but it will probably only make its way in Gatling Enterprise.
Can't you explicitly check for status 200, instead of using the default one?
slandelle
changed the title
(Question / FeatureRequest) HTTP - unable to create assertion in session exec
Core: custom metrics and assertions
Jan 24, 2022
I was thinking about it. But the counters are not working properly in this http request exec. So that, I assumed that I need to use them in request.during(<some time>) block. Am I doing sth wrong?
Hi,
I'm unable to make assertion in exec block of code (Scala test) that fails the test if it's not passed.
My Gatling version I'm using is '3.7.3'
I'm doing request to http separately like:
And then I'm using it in definition of function like:
I'd like to add some assertion in this
someFunction
to check, if percentage of successful requests (statusCode == 200) is not less than 10.I've tried adding something like:
But it does not fail the test scenario, when it's below that 10%.
I've tried using
exitHereIfFailed
or any of those types from Gatling documentation (but with no luck).Moreover, I also added
.assertions(forAll.failedRequests.count.is(0))
in setUp section. This also did not work (test is still ending withBuild Successful
).I'm aware, there is also possibility to use an assertion for global requests (
assertions(global.successfulRequests.percent.gt(10))
), but I need my custom one.Also I do not want to use any
check
, because counters (allRequests and successes) must be inrequest.during(<some time>)
block.Is there any option to use my custom counters and check percentage of successful request as in my example?
The text was updated successfully, but these errors were encountered: