You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Aaron Tracy <Aa...@octanner.com> on 2014/03/19 16:00:43 UTC

Negative Testing

Hi!

  I'm attempting to test for error conditions in my applications api using jmeter.  If I try to access a device that isn't available, my api should return a 401.  Well, that's an error code and so Jmeter will flag it as an error.  But what if I'm expecting it to return a 401?  I'd like to have JMeter report that 401 as a pass, not a failure... is there any way to change what return code is a pass/failure?

Re: Negative Testing

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
There is a flag on the response assertion that says ignore status - you can
then validate the response code is as you expect
http://jmeter.apache.org/usermanual/component_reference.html#Response_Assertion

Ignore status Instructs JMeter to set the status to success initially.

The overall success of the sample is determined by combining the result of
the assertion with the existing Response status. When the Ignore Status
checkbox is selected, the Response status is forced to successful before
evaluating the Assertion.
HTTP Responses with statuses in the 4xx and 5xx ranges are normally
regarded as unsuccessful. The "Ignore status" checkbox can be used to set
the status successful before performing further checks. Note that this will
have the effect of clearing any previous assertion failures, so make sure
that this is only set on the first assertion.  Yes


On Wed, Mar 19, 2014 at 8:00 AM, Aaron Tracy <Aa...@octanner.com>wrote:

> Hi!
>
>   I'm attempting to test for error conditions in my applications api using
> jmeter.  If I try to access a device that isn't available, my api should
> return a 401.  Well, that's an error code and so Jmeter will flag it as an
> error.  But what if I'm expecting it to return a 401?  I'd like to have
> JMeter report that 401 as a pass, not a failure... is there any way to
> change what return code is a pass/failure?
>