Thursday, January 08, 2009

JMeter While/if controller---set the conditions

in JMeter while controller, I just want to use multiple conditions to controll the while loop, it supports __javaScript function, so I use as following first:

${__javaScript(${usefulnessflag_g1}<0,)}&&${__javaScript(${pagenum}<${pagenummax1}),)} but Jmeter stop at that While controller, I releaized the condition not work this way

Change it into right way, just use single __javaScript function including multiple conditions, then it works well:

${__javaScript((${usefulnessflag_g1}<0)&&(${pagenum}<${pagenummax1}),)}

and Meanwhile , I found one issue of Jmeter,

I use "if controller", and find the error message in JMeter.log:

ERROR - jmeter.control.IfController: missing ; before statement (#1) org.mozilla.javascript.EvaluatorException: missing ; before statement (#1)

then i isolate problem, it happens on this line: ${__javaScript("${reviewflag2}"=="",)},

I set this string compare into if controller condition field, but it failed---not always.... i realized that try to remove the __javaScript function, then change it into:

"${reviewflag2}"=="", it worked!! so it might be a bug in Jmeter "if controller"....

for ${usefulnessflag_g1}>0, it also works well as ${__javaScript(${usefulnessflag_g1}>0,)} :)

hope it help you !

No comments:

Post a Comment