if statement - How to find if URL contains specific format and then run execute current transcation -
i have 2 transaction controllers in jmeter. i'd execute first transaction if ${url} contains -1 @ end , second transactions if ${url} not contain -1 @ end.
${url} variable comes csv data set config. it's regular http url.
this how jmeter test plan looks like:
thread group --csv data set config --transaction 1 --http request execute ${url} -- transaction 2 ----http request execute ${url} now can add if above each transaction not sure should compare if statement with.
sample url:
first url - /test/user/editprofile/userid/1234 -1 second url - /test/user/viewprofile/userid/8975
the first url should run under first transactions , second url should run under second transactions.
in if controller can put following condition:
"${__beanshell('${url}'.contains('-1'))}" the children of if controller executed if url contians -1. need second if controller with:
"${__beanshell(!'${url}'.contains('-1'))}" for second request.
another option use switch controller first request first child , second second child. in post processor need set variable 0 or 1 depending on result.
var url = vars.get('url'); var switch = 0; if(!url.contains('-1')) switch = 1; vars.put('switch', switch.tostring()); use ${switch} condition variable in switch controller.
Comments
Post a Comment