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 2022/09/06 03:14:37 UTC
JMeter If Controller, "Not" operator
Hi,
Does the JMeter If Controller has a "Not" operator?
https://jmeter.apache.org/usermanual/component_reference.html#If_Controller
I.e. can I use
!${JMeterThread.last_sample_ok}
?
Re: JMeter If Controller, "Not" operator
Posted by Dmitri T <gl...@live.com>.
If Controller will execute its children if the function (or variable)
you place in the condition field returns *true*
If you want to execute something conditionally if the previous sampler
is not successful you can use i.e. __groovy() function
<https://jmeter.apache.org/usermanual/functions.html#__groovy> like:
${__groovy(vars.get('JMeterThread.last_sample_ok') == 'false',)}
Where *vars* stands for JMeterVariables
<https://jmeter.apache.org/api/org/apache/jmeter/threads/JMeterVariables.html>class
instance, see Top 8 JMeter Java Classes You Should Be Using with Groovy
<https://www.blazemeter.com/blog/jmeter-java-classes> article for more
information on this and other JMeter API shorthands available for the
JSR223 Test Elements
On 9/6/2022 5:14 AM, Tong Sun wrote:
> Hi,
>
> Does the JMeter If Controller has a "Not" operator?
>
> https://jmeter.apache.org/usermanual/component_reference.html#If_Controller
>
> I.e. can I use
>
> !${JMeterThread.last_sample_ok}
>
> ?
>