Reputation: 535
Having massive problems with something that should be simple, due to my lack of understanding of jmeter.
I have a test consisting of:
CSV Data Set config
Http Request
If controller(containing Json Path extractor and an assertion)
I only want the contents of the If statement to execute if a particular variable in the CSV is set to 'Y'.
Variable name in CSV = Check_For_Selector
The condition I've placed on the IF is "${Check_For_Selector}"="Y"
This doesn't work and I can't work out why.
Please note that I am using Jmeter 2.13 (forced to use this rather than 3.1).
What the heck am I doing wrong?
Upvotes: 1
Views: 2003
Reputation: 6398
As Dmitri mentioned, you have to use ==
instead of =
operator for comparison.
If still NOT working, please check below:
You should NOT keep Post-Processors and Assertions
(Also, Pre-processors
) without any enclosing Sampler in its scope. They won't be executed if there is NO sampler in their scope.
As you kept, JSON Path Extractor & Assertion
inside an If Controller
, where their scope is now, only limited to the Controller, they are NOT aware of the Sampler (HTTP Request
, outside the If Controller
), JMeter
won't execute them.
Solution:
Keep HTTP Request
inside If Controller
Or Keep JSON Path Extractor & Assertion
as a child of HTTP request
.
References:
Upvotes: 1
Reputation: 168157
In JavaScript you need to use ==
operator to compare two strings like
"${Check_For_Selector}"=="Y"
See How to Use JMeter's 'IF' Controller for more details on how to execute JMeter samplers conditionally with the help of the If Controller
Upvotes: 1