You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Noel O'Brien <no...@newbay.com> on 2009/01/26 18:29:30 UTC

JMeter assumes a 4XX response code is a failure

Hi All,

I'm using JMeter to do some negative testing on my webapp, but when I add a 
Response Assertion which (correctly) expects that the response code will be 
404, the result is always a fail.

I looked through the source code and it appears in HTTPSamplerBase, that 
JMeter will only check the response assertion for codes 200-399 inclusive; 
otherwise it assumes it's a failure.

To me this is a bug in JMeter as it prevents one from executing negative 
testing. Perhaps if a response assertion was omitted, then it would be 
logical to assume that a 4XX would be a failure, but when I've specified that 
I expect a 4XX shouldn't it be honoured?

Does any one know of a way to get around this problem? I'd appreciate any 
feedback on this issue.

Regards,
Noel

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: JMeter assumes a 4XX response code is a failure

Posted by Noel O'Brien <no...@newbay.com>.
I "Read the FM" but missed that bit ;) Thanks Sebb for pointing it out!

Regards,
Noel

On Monday 26 January 2009 17:51:46 sebb wrote:
> On 26/01/2009, Noel O'Brien <no...@newbay.com> wrote:
> > Hi All,
> >
> >  I'm using JMeter to do some negative testing on my webapp, but when I
> > add a Response Assertion which (correctly) expects that the response code
> > will be 404, the result is always a fail.
> >
> >  I looked through the source code and it appears in HTTPSamplerBase, that
> >  JMeter will only check the response assertion for codes 200-399
> > inclusive; otherwise it assumes it's a failure.
> >
> >  To me this is a bug in JMeter as it prevents one from executing negative
> >  testing. Perhaps if a response assertion was omitted, then it would be
> >  logical to assume that a 4XX would be a failure, but when I've specified
> > that I expect a 4XX shouldn't it be honoured?
>
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Respon
>se_Assertion
>
> says
>
> "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. "
>
> >  Does any one know of a way to get around this problem? I'd appreciate
> > any feedback on this issue.
> >
> >  Regards,
> >  Noel
> >
> >  ---------------------------------------------------------------------
> >  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> >  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: JMeter assumes a 4XX response code is a failure

Posted by sebb <se...@gmail.com>.
On 26/01/2009, Noel O'Brien <no...@newbay.com> wrote:
> Hi All,
>
>  I'm using JMeter to do some negative testing on my webapp, but when I add a
>  Response Assertion which (correctly) expects that the response code will be
>  404, the result is always a fail.
>
>  I looked through the source code and it appears in HTTPSamplerBase, that
>  JMeter will only check the response assertion for codes 200-399 inclusive;
>  otherwise it assumes it's a failure.
>
>  To me this is a bug in JMeter as it prevents one from executing negative
>  testing. Perhaps if a response assertion was omitted, then it would be
>  logical to assume that a 4XX would be a failure, but when I've specified that
>  I expect a 4XX shouldn't it be honoured?

http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Response_Assertion

says

"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. "

>  Does any one know of a way to get around this problem? I'd appreciate any
>  feedback on this issue.
>
>  Regards,
>  Noel
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org