Bug 32790 - IfController only evaluated once within a LoopController
IfController only evaluated once within a LoopController
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
2.0.1
PC Windows XP
: P2 major (vote)
: ---
Assigned To: JMeter issues mailing list
:
: 32920 33276 (view as bug list)
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2004-12-21 15:14 UTC by Andreas Oetjen
Modified: 2005-03-11 18:42 UTC (History)
2 users (show)



Attachments
.jmx-Script (22.41 KB, text/plain)
2004-12-22 06:50 UTC, Andreas Oetjen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Oetjen 2004-12-21 15:14:29 UTC
I have the following:
LoopController (3 times)
  Counter (1 to 3)
  If (${counter} == 1))
      SampleResult => "one"
  If (${counter} != 1))
      SampleResult => "not one"
ResultTree


If I execute this script, it shows three times the result "one", but I would 
expect "one", "not one" and "not one"

By the way: Is there a way to attach anything to a bug??
Comment 1 Sebb 2004-12-22 02:32:24 UTC
Attachments can be added to bugs once they have been created ...
Comment 2 Andreas Oetjen 2004-12-22 06:50:44 UTC
Created attachment 13817 [details]
.jmx-Script

.jmx-Script shows that the IfContoller condition seems to be evaluated only
once
Comment 3 Gregor Kappler 2005-01-26 14:57:36 UTC
I had the same Problem with Version 2.0.2.
The Prob is, that the CONDITION is not set to RunningVersion and recovered after
each evaluation. I set the Property correctly by modifying setCondition and
getCondition. Now it works correctly with my local patched version.

Here is the fixed code snippet:

	  /**
	   * Condition Accessor - this is gonna be like     ${count}<10
	   */
	  public void setCondition(String condition) {
              
              StringProperty prop=new StringProperty(CONDITION, condition);
              prop.setRunningVersion(true);
              logger.debug("    setCondition() : [" + condition + "]="+prop);
              setProperty(prop);
	  }

	  /**
	   * Condition Accessor - this is gonna be like     ${count}<10
	   */
	  public String getCondition() {
                        JMeterProperty prop=(JMeterProperty)getProperty(CONDITION);
			logger.debug("    getCondition() : [" + prop.getClass().getName() + "]");
	  		String result=prop.getStringValue();
                        prop.recoverRunningVersion(null);
                        return result;
	  }
Comment 4 Sebb 2005-03-12 03:27:49 UTC
Fixed in 2.0 branch
Comment 5 Sebb 2005-03-12 03:29:47 UTC
*** Bug 32920 has been marked as a duplicate of this bug. ***
Comment 6 Sebb 2005-03-12 03:42:23 UTC
*** Bug 33276 has been marked as a duplicate of this bug. ***