jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thad Smith <thads...@yahoo.com>
Subject Re: Is it possible to Terminate JMeter based on results of response \ assertion?
Date Thu, 29 Apr 2004 20:50:14 GMT
Andrew,

I included some information about this in a previous
note today, but you can use the Test Action sampler to
terminate JMeter. Place it in an If Controller and set
the condition of the If Controller to test if your
condition is true. Set the Test Action to Stop and it
should do the trick for you.

Regards,

Thad Smith

--- andrew.roughan@writeme.com wrote:
> I've been using JMeter with reasonable success for
> the last few months. I now need some more fine
> grained control of how to terminate JMeter.
> 
> The functionality of "Action to be taken after a
> Sampler error" is not good enough for me. Here's my
> situation:
> 
> Responses from the web service that I'm testing
> could 
> be:
> 
> HTTP response 500: Internal Server Error
> HTTP response 401: Unauthorized
> HTTP response 302: Moved temporarily
> 
> when it is response 302, the server is returning a
> URL to 
> redirect to. I want to be able to parse the URL.
> 
> If the condition that I'm looking for in the URL is
> met, 
> then I want to stop the thread.
> 
> I am already using "Response Assertion" to parse the
> URL.
> 
> If I use the "Result Status Action Handler" with 
> "Stop Thread", my thread is terminated when my
> parsed 
> condition is met OR if I get an HTTP error response
> code (e.g. 401)
> 
> I want to be able to stop the thread ONLY IF my
> parsed condition is met.
> 
> I guess this would require a distinction between
> Result Errors and Parsing Conditions.
> 
> Can this be done now with some other components? If
> not, is implementation for this planned soon?
> 
> Thanks,
> Andrew
> 
> 
> BTW JMeter 2.0.0 is much more memory stable than
> 1.9.1. THANK YOU! 
> 
> 
> ----- Original Message -----
> From: "Sebastian Bazley" 
> Date: Tue, 9 Dec 2003 23:28:43 -0000
> To: "JMeter Users List" 
> Subject: Re: Is it possible to Terminate JMeter
> based on results of response \ assertion?
> 
> > 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" 
> > To: "JMeter Users List" 
> > Sent: Tuesday, December 09, 2003 1:41 AM
> > Subject: Re: Is it possible to Terminate JMeter
> based on results of response \ assertion? 
> > 
> > > ----- Original Message ----- 
> > 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!
> > > 
> -- 
> _______________________________________________
> Get your free email from http://www.iname.com
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> jmeter-user-help@jakarta.apache.org
> 



	
		
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

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