You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Tong Sun <su...@gmail.com> on 2021/02/25 14:20:46 UTC
Exiting the jsr223 sampler
Hi,
Quick & simple question, how to stop the jsr223 script from reaching
the following processing code (B), return, exit, or ...?
if (A) exit
B
I just want the jsr223 script not to process the following code, B,
not to stop the whole thread execution, of which it's the only hits
I've found from the internet so far.
thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Re: Exiting the jsr223 sampler
Posted by "glinius@live.com" <gl...@live.com>.
return <https://www.w3schools.com/java/ref_keyword_return.asp> keyword will
stop the sampler execution once it's reached.
If you add a string like:
> return 'A'
the JSR223 Sampler result will be *A*
no lines after the *return* keyword will be executed.
More information on Groovy scripting in JMeter: Apache Groovy - Why and How
You Should Use It <https://www.blazemeter.com/blog/groovy-new-black>
--
Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Re: Exiting the jsr223 sampler
Posted by Mariusz W <ma...@gmail.com>.
Hi,
If tere is such possibility You can also use "If Controller" to check some conditions. In this controller you can use groovy code as well to check some conditions (e.g. ${__groovy(vars.get('foo') != 'boo')} - it may easier to analyzing in future when you back to script.
Mariusz
On 2021/02/25 14:20:46, Tong Sun <su...@gmail.com> wrote:
> Hi,
>
> Quick & simple question, how to stop the jsr223 script from reaching
> the following processing code (B), return, exit, or ...?
>
> if (A) exit
> B
>
> I just want the jsr223 script not to process the following code, B,
> not to stop the whole thread execution, of which it's the only hits
> I've found from the internet so far.
>
> thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Re: Exiting the jsr223 sampler
Posted by Jmeter Tea <jm...@gmail.com>.
Hello,
You can throw Exception, as:
if(A) {
throw new Exception("a");
}
But usually you just put B in else,as:
if (A) {
} else {
B
}
or one if nothing to do when A == true:
if (!A) {
B
}
On Thu, Feb 25, 2021 at 4:21 PM Tong Sun <su...@gmail.com> wrote:
> Hi,
>
> Quick & simple question, how to stop the jsr223 script from reaching
> the following processing code (B), return, exit, or ...?
>
> if (A) exit
> B
>
> I just want the jsr223 script not to process the following code, B,
> not to stop the whole thread execution, of which it's the only hits
> I've found from the internet so far.
>
> thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>