0

This is what I have:

. . .
Loop Controller
+- HTTP Request getting data from one source
   +- BSF PostProcessor copying the data from the request into variables
+- SOAP/XML-RPC Request getting data from another source
   +- XPath Extractors (several) copying the data from the request into variables
+- If Controller
   +- BSF PostProcessor
. . .

I can see all the variables being set properly using the Debug Sampler through the View Results Tree.

I've tried several things. Everything I've searched for suggested the If Controller is what I should be using. And Yes, the If Controller is enabled.

What I really need to do is this compare: "${opp_Name1}" == "${opp_Name1}"; <-- I've done the compare both with and without the semi-colon, no difference.

When I look in the View Results Tree, it doesn't appear that the If Controller is firing. Below the If Controller, I have a BSF PostProcessor to set another variable if the condition is true; this new variable does not show up in Debug Sampler after the run, all my other variables do show up in Debug Sampler as expected. In the If Controller, I have also tried running with "Interpret Condition as Variable Expression?" checked and unchecked without any difference.

Any suggestions or ideas?

Aliaksandr Belik
  • 12,725
  • 6
  • 64
  • 90
Harlan
  • 9
  • 2
  • 6

1 Answers1

1

Hm. Works fine as for me in accordance with the following schema:

. . .
Loop Controller
+- BeanShell Sampler : vars.put("var1","test");
+- BeanShell Sampler : vars.put("var2","test");
+- If Controller : "${var1}"=="${var2}"
   +- BeanShell Sampler
. . .

(condition resolved as "true", child Sampler executed).


Several notes to this:

  1. Look into jmeter.log (%JMETER_HOME%/bin dir) for possible messages from IF Controller (If there is an error interpreting the code, the condition is assumed to be false, and a message is logged in jmeter.log).

  2. Uncheck checkbox "Interpret Condition as Variable Expression?" on IF Controller's control panel - if checked.

  3. Look into answers to this: JMeter "if controller" with parameters?. This may be helpful.

Community
  • 1
  • 1
Aliaksandr Belik
  • 12,725
  • 6
  • 64
  • 90
  • While your schema is not the same as mine, I did enter yours into JMeter to verify I'm getting the same results. I did not see anything to show that the If Controller actually ran! I'm running Apache JMeter version 2.6 r1237317. – Harlan Jun 01 '12 at 15:52
  • @ Harlan. I've used last [2.7](http://jmeter.apache.org/changes.html), by the way. Possibly something in jmeter.log? – Aliaksandr Belik Jun 01 '12 at 16:35
  • Hi Alies. I looked in the log file, nothing was showing up with errors or saying it skipped anything. I can get the latest version of JMeter and try again. – Harlan Jun 01 '12 at 17:11
  • I just tried your schema with JMeter 2.7. Same results. Nothing showing in log files or View Results Tree showing that the If Condition or PostProcessor fired. The variable that is supposed to get set in the PostProcessor didn't get set according to the Debug Sampler. Any other ideas or suggestions? – Harlan Jun 01 '12 at 18:51
  • Seems I've had a typo: originally BeanshellSampler used as child of IF Controller, not PostProcessor (corrected above), sorry for this. Anyway here is test-script I've used for this: http://cl.ly/3D1N2v2D1n0p1e0Z1n0I (works as expected with out-of-the-box Jmeter 2.7 + JDK 1.7.0). – Aliaksandr Belik Jun 04 '12 at 11:05
  • A couple of things. (1) As you did, I switched from the BSF PostProcessor to the BeanShell Sampler in my IF Controller, this allowed me to see that I was indeed getting matches and set the variable I needed. (2) System.out.println's do not seem to work in the BSF PostProcessor, but work fine in the BeanShell Sampler. Thanks again for your assistance!! I'm up and running - until the next problem. (-; Harlan... – Harlan Jun 04 '12 at 17:37
  • Good luck to you. And sorry for my typo. – Aliaksandr Belik Jun 04 '12 at 17:48
  • I appreciated your help! I do have the comparisons working now. That's the important part. :) – Harlan Jun 05 '12 at 18:42