jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebastian Bazley" <Sebastian.Baz...@london.sema.slb.com>
Subject Re: Is it possible to Terminate JMeter based on results of response assertion?
Date Tue, 09 Dec 2003 23:28:43 GMT
I've added Post Processor to CVS which can be used to stop a thread or the test if a sample
failed.

Sample usage:

Loop Controller
   Sampler
      Assertion
  Response Action Error Handler

Hope this helps.

S.
----- Original Message ----- 
From: "Sebastian Bazley" <Sebastian.Bazley@london.sema.slb.com>
To: "JMeter Users List" <jmeter-user@jakarta.apache.org>
Sent: Tuesday, December 09, 2003 1:41 AM
Subject: Re: Is it possible to Terminate JMeter based on results of response assertion?


> ----- Original Message ----- 
> From: <andrew.roughan@writeme.com>
> To: <jmeter-user@jakarta.apache.org>
> Sent: Tuesday, December 09, 2003 12:40 AM
> Subject: Is it possible to Terminate JMeter based on results of response assertion?
>
>
> > I am using JMeter to send a request to a web service.
> > The web service will respond negatively for many iterations and then could either
> > respond positively once and then respond with an alternative negative response,
or
> > simply respond with an alternate negative response
> >
> > What I'd like to do is to terminate sending requests after either the positive or
the alternate negative response has been
> received.
> >
> > Is this possible? If so, how would it be done?
>
> The following suggestions relate to builds after 1.9.1, so you would need to download
one of the nightly builds.
>
> The Thread Group now has a set of options for action to be taken on Sampler Error.
> You could set the action to Stop Thread or Stop Test, and then add the appropriate Assertions
to cause the Sample to fail where
> required. This assumes that the web service encodes the positive/negative reponse in
the data, rather than in the HTTP response
> code - i.e. the Sample responses must be successful; you can then use the Assertion to
set the sample as failed.
>
> [The plan was to extend the Stop on Error options to allow more fine-grained control,
but this has not yet been implemented.]
>
> However, if you are prepared to code a short Java script, what you ask should be possible
using the latest CVS build - provided
that
> you get one with BeanShell support compiled in (the build log will tell you if so). You
would also need to download the beanshell
> jar from www.beanshell.org as this is not distributed with JMeter.
>
> The BeanShell Response Assertion allows you access to all the response fields and methods,
including stopThread() and stopTest().
>
> The response fields are accessible as the following variables (Strings):
> ResponseData - this is of type byte []
> ResponseCode
> ResponseMessage
> ResponseHeaders
>
> So you could code something like:
>
> if (ResponseCode.equals("123")) {
> Response.setStopThread(true);
> }
>
> >
> > The nature of the web service is such that there will be an unknown number of initial
negative iterations.
> >
>
> Such is life!
>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message