How to use the Duration Assertion to fail a test?
The Apache JMeter Duration Assertion documentation http://jmeter.apache.org/usermanual/component_reference.html#Duration_Assertion
Definition: The Duration Assertion validates that each response is received within a given amount of time. Any response that takes longer than the given number of milliseconds (specified by the user) is recorded as a failed response.
Parameter | Usage |
Duration in milliseconds | If the requests take longer than ms supplied, Sampler is considered failed |
Apply to
|
This is for use with samplers that can generate sub-samples, e.g. HTTP Sampler with embedded resources |
-
Create your test plan
- Here is an example which queries 4 URLS
-
If you want to test performance of a single URL
- Add duration assertion under the HTTP Sampler
-
If you want to apply assertion to all Samplers
- Add duration at same level
-
Check it locally
- We will use the single failure case and set it to 10ms, forcing it to fail in every iteration
- We can see our test failing
-
Run it on RedLine13
- We can see error log showing output
- The error requests will display in Error Metrics graphs