Reputation: 5396
Here is map what I am looking for :
What I have done for retailer :
Code :
String URL = prev.getURL().toString();
vars.put("URL", URL);
if (vars.get("URL").contains("retailer")) {
log.info("PASS");
} else {
log.info("FAIL");
}
Above code works well.
I tried following for IF controller but seems not working :
"${URL}".contains("retailer")
I feel like jmeter ignoring IF controller as I am not getting any error.
Goal is to execute specific requests based on user role like retailer/reseller.
Upvotes: 0
Views: 698
Reputation: 168122
You don't have contains()
function in JavaScript, you need to use indexOf() function instead so your If Controller condition should be like:
"${URL}".indexOf("retailer") != -1
Remember to always look into jmeter.log file when your test doesn't work as expected, in 99.9% of cases you can figure out the reason from it.
Upvotes: 1