You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by an...@writeme.com on 2004/04/23 07:53:19 UTC

Re: Is it possible to Terminate JMeter based on results of response \ assertion?

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


Re: Is it possible to Terminate JMeter based on results of response \ assertion?

Posted by Thad Smith <th...@yahoo.com>.
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


Re: JMeter doesn't take data from the field "Path" of the "HTTP Request Defaults" element

Posted by Michael Stover <ms...@apache.org>.
This sounds like it was caused by the same mysterious bug that broke the
proxy server.  I fixed it for the proxy, but I was not able to find
exactly what had been changed that broke things.  

The problem seems to have to do with the PATH and ENCODED_PATH
properties of HTTPSampler.  

-Mike

On Thu, 2004-04-29 at 09:33, Vladimir Tsygankov wrote:
> JMeter doesn't insert the field "Path" from "HTTP Request Defaults"
> element into the requests.
> Because of that problems all of our tests which worked fine under
> Jmeter-20040215 don't work now.
> Can anybody help us please?
> 
> Thanks in advance,
> Vladimir
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
-- 
Michael Stover <ms...@apache.org>
Apache Software Foundation


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


Re: JMeter doesn't take data from the field "Path" of the "HTTP Request Defaults" element

Posted by Michael Stover <ms...@apache.org>.
This sounds like it was caused by the same mysterious bug that broke the
proxy server.  I fixed it for the proxy, but I was not able to find
exactly what had been changed that broke things.  

The problem seems to have to do with the PATH and ENCODED_PATH
properties of HTTPSampler.  

-Mike

On Thu, 2004-04-29 at 09:33, Vladimir Tsygankov wrote:
> JMeter doesn't insert the field "Path" from "HTTP Request Defaults"
> element into the requests.
> Because of that problems all of our tests which worked fine under
> Jmeter-20040215 don't work now.
> Can anybody help us please?
> 
> Thanks in advance,
> Vladimir
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
-- 
Michael Stover <ms...@apache.org>
Apache Software Foundation


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


JMeter doesn't take data from the field "Path" of the "HTTP Request Defaults" element

Posted by Vladimir Tsygankov <Vl...@contera.sp.ru>.
JMeter doesn't insert the field "Path" from "HTTP Request Defaults"
element into the requests.
Because of that problems all of our tests which worked fine under
Jmeter-20040215 don't work now.
Can anybody help us please?

Thanks in advance,
Vladimir


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