Luis Serrano
Luis Serrano

Reputation: 87

When using ant to run jmeter, is it possible to fail test cases not only based in HTTP status codes but also in response time?

I just did a quick test to run jmeter using Ant. I see an html report that shows success rate based on HTTP status codes:

Ant Jmeter Report

Is it possible to do anything so that say, requests that take more than 1 second are considered as failures too?

So in short I want the report to show failure when the HTTP code is not 2XX and also when response time greater than say 1 sec

Thanks!

Upvotes: 0

Views: 63

Answers (2)

Dmitri T
Dmitri T

Reputation: 168197

  1. In order to check HTTP Status code being 2xx add a Response Assertion to the Sampler(s) which you want to have checked (JMeter Assertions respect JMeter Scoping Rules) and configure it like:

    enter image description here

  2. In order to conditionally fail requests which take longer than 1 second add Duration Assertion (the same Scoping Rules apply) and configure it like:

    enter image description here

Check out How to Use JMeter Assertions in Three Easy Steps article to learn more how you can conditionally mark JMeter samplers as passed/failed using Assertions.

Upvotes: 1

Ori Marko
Ori Marko

Reputation: 58882

Add to your test Duration Assertion with value of 1000 (Milliseconds)

Duration in Milliseconds The maximum number of milliseconds each response is allowed before being marked as failed.

Upvotes: 0

Related Questions