Reputation: 17
IfController not getting executed in my Jmeter that is defined under forEach controller.
Trying to use Jmeter to perform the below scenario. Can this be achieved?
"- Connect to the database (Used a JDBC connection) - Run a SQL to fetch a list of batch records say it returns B1, B2 and B3 batches (Used a JDBC request) - For each of the batch records obtained, run a SQL to fetch corresponding shipments (Used a ForEach Controller and JDBC request) - if the count of shipments in each batch is less than 5 (Used a If Controller) - Run a new SQL to fetch new set of shipment for the same batch (Used a ForEach Controller) -For each shipment, call a application API (Used a HTTP request)"
I see the first ForEach Controller is excuted but I dont see the if Controller being executed. To make the condition simple in the if controller i used this condition - 1==1 and also tried with this (${__jexl3(vars.get("JMeterThread.last_sample_ok")=="true" && (vars.getObject("shipmentCount1").size() < 2 ),)})
Upvotes: 0
Views: 114
Reputation: 168002
You need to remove parentheses from your If Controller's condition because it results into (true)
which cannot be cast to true
hence your If Controller's children are not executed
Correct expression: ${__jexl3(vars.get("JMeterThread.last_sample_ok")=="true" && (vars.getObject("shipmentCount1").size() < 2 ),)}
Demo:
If Controller setup just in case:
Always check JMeter Functions and/or Variables values using Debug Sampler and View Results Tree listener combination
Upvotes: 0