Am 04.07.2018 14:03, schrieb Philippe Mouawad:
Hello Felix,

There is User Parameters which declares counter under Flow Control Action
It's a real issue related to last commit I did.

2018-07-04 14:28:46,362 INFO o.a.j.e.StandardJMeterEngine: Waiting for thread group: TG-BL-WC to finish before starting next group 2018-07-04 14:28:46,363 INFO o.a.j.t.JMeterThread: Thread started: TG-BL-WC 2-1 2018-07-04 14:28:46,364 DEBUG o.a.j.c.WhileController: Condition string: 'true' 2018-07-04 14:28:46,365 DEBUG o.a.j.c.WhileController: Condition value: 'false' 2018-07-04 14:28:46,365 DEBUG o.a.j.m.UserParameters: TG-BL-WC 2-1 iteration start false 2018-07-04 14:28:46,366 DEBUG o.a.j.m.UserParameters: TG-BL-WC 2-1 process false 2018-07-04 14:28:46,366 DEBUG o.a.j.m.UserParameters: TG-BL-WC 2-1 Running up named: User Parameters 2018-07-04 14:28:46,366 DEBUG o.a.j.m.UserParameters: TG-BL-WC 2-1 saving variable: counter=0 2018-07-04 14:28:46,367 DEBUG o.a.j.c.WhileController: Condition string: 'true' 2018-07-04 14:28:46,368 DEBUG o.a.j.c.WhileController: Condition value: 'false' 2018-07-04 14:28:46,370 DEBUG o.a.j.c.WhileController: Condition string: 'true' 2018-07-04 14:28:46,372 DEBUG o.a.j.c.WhileController: Condition value: 'false'

The UserParameter is initialized after the WhileController. (For this run I added a User Defined Variable "counter=0").

The change that triggers this is the new call to endLoop(true). But maybe I misunderstand the problem and barfing up the wrong tree :)

Felix


Regards

On Wed, Jul 4, 2018 at 1:59 PM, Felix Schumacher <
[email protected]> wrote:

Am 03.07.2018 23:15, schrieb Philippe Mouawad:

This commit breaks build.


For comments see below (very far down).



Regards

On Tuesday, July 3, 2018, <[email protected]> wrote:

Author: pmouawad
Date: Tue Jul  3 20:16:38 2018
New Revision: 1835022

URL: http://svn.apache.org/viewvc?rev=1835022&view=rev
Log:
Bug 62238 - Add ability to Switch to next iteration of Current Loop

Fix issue in nightly
Bugzilla Id: 62238

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/control/
ForeachController.java
    jmeter/trunk/src/core/org/apache/jmeter/control/
IteratingController.java
jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java jmeter/trunk/src/core/org/apache/jmeter/control/WhileController.java

Modified: jmeter/trunk/src/components/org/apache/jmeter/control/
ForeachController.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/
org/apache/jmeter/control/ForeachController.java?rev=
1835022&r1=1835021&r2=1835022&view=diff
============================================================
==================
--- jmeter/trunk/src/components/org/apache/jmeter/control/Foreac
hController.java
(original)
+++ jmeter/trunk/src/components/org/apache/jmeter/control/Foreac
hController.java
Tue Jul  3 20:16:38 2018
@@ -20,6 +20,7 @@ package org.apache.jmeter.control;

 import java.io.Serializable;

+import org.apache.jmeter.engine.event.LoopIterationEvent;
 import org.apache.jmeter.gui.GUIMenuSortOrder;
 import org.apache.jmeter.samplers.Sampler;
 import org.apache.jmeter.testelement.property.BooleanProperty;
@@ -318,4 +319,10 @@ public class ForeachController extends G
         resetLoopCount();
         recoverRunningVersion();
     }
+
+    @Override
+    public void iterationStart(LoopIterationEvent iterEvent) {
+        reInitialize();
+        resetLoopCount();
+    }
 }

Modified: jmeter/trunk/src/core/org/apache/jmeter/control/
IteratingController.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/
apache/jmeter/control/IteratingController.java?rev=
1835022&r1=1835021&r2=1835022&view=diff
============================================================
==================
--- jmeter/trunk/src/core/org/apache/jmeter/control/IteratingCon
troller.java
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/control/IteratingCon
troller.java
Tue Jul  3 20:16:38 2018
@@ -18,6 +18,7 @@

 package org.apache.jmeter.control;

+import org.apache.jmeter.engine.event.LoopIterationListener;
 import org.apache.jmeter.threads.JMeterContextService;
 import org.apache.jmeter.threads.JMeterVariables;
 import org.apache.jmeter.util.JMeterUtils;
@@ -26,7 +27,7 @@ import org.apache.jmeter.util.JMeterUtil
  * Identify controller that does iterations
  * @since 4.1
  */
-public interface IteratingController {
+public interface IteratingController extends LoopIterationListener {

     /**
* Start next iteration ("continue" keyword equivalent in loops)

Modified: jmeter/trunk/src/core/org/apache/jmeter/control/
LoopController.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/
apache/jmeter/control/LoopController.java?rev=
1835022&r1=1835021&r2=1835022&view=diff
============================================================
==================
--- jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java
Tue Jul  3 20:16:38 2018
@@ -20,23 +20,27 @@ package org.apache.jmeter.control;

 import java.io.Serializable;

+import org.apache.jmeter.engine.event.LoopIterationEvent;
+import org.apache.jmeter.engine.event.LoopIterationListener;
 import org.apache.jmeter.samplers.Sampler;
 import org.apache.jmeter.testelement.property.BooleanProperty;
 import org.apache.jmeter.testelement.property.IntegerProperty;
 import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.testelement.property.StringProperty;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

 /**
* Class that implements the Loop Controller, ie iterate infinitely or a
configured number of times
  */
-public class LoopController extends GenericController implements
Serializable, IteratingController {
+public class LoopController extends GenericController implements
Serializable, IteratingController, LoopIterationListener {

public static final int INFINITE_LOOP_COUNT = -1; // $NON-NLS-1$

     public static final String LOOPS = "LoopController.loops"; //
$NON-NLS-1$

private static final long serialVersionUID = 7833960784370272300L;
-
+    private static final Logger LOGGER = LoggerFactory.getLogger(
LoopController.class);
     /**
* In spite of the name, this is actually used to determine if the
loop controller is repeatable.
      *
@@ -221,4 +225,13 @@ public class LoopController extends Gene
         resetLoopCount();
         recoverRunningVersion();
     }
+
+    @Override
+    public void iterationStart(LoopIterationEvent iterEvent) {
+        if(LOGGER.isInfoEnabled()) {
+ LOGGER.info("iterationStart called on {} with source {} and
iteration {}", getName(), iterEvent.getSource(),
iterEvent.getIteration());
+        }
+        reInitialize();
+        resetLoopCount();
+    }
 }

Modified: jmeter/trunk/src/core/org/apache/jmeter/control/
WhileController.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/
apache/jmeter/control/WhileController.java?rev=
1835022&r1=1835021&r2=1835022&view=diff
============================================================
==================
--- jmeter/trunk/src/core/org/apache/jmeter/control/WhileController.java
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/control/WhileController.java
Tue Jul  3 20:16:38 2018
@@ -20,6 +20,7 @@ package org.apache.jmeter.control;

 import java.io.Serializable;

+import org.apache.jmeter.engine.event.LoopIterationEvent;
 import org.apache.jmeter.samplers.Sampler;
 import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.testelement.property.StringProperty;
@@ -160,4 +161,11 @@ public class WhileController extends Gen
         resetLoopCount();
         recoverRunningVersion();
     }
+
+    @Override
+    public void iterationStart(LoopIterationEvent iterEvent) {
+        reInitialize();
+        endOfLoop(true);


The exception happens here. I believe it is because the Counter is not
initialized yet and the jexl expression is testet on
"${counter} != 10", but there is no variable named counter and therefor it
doesn't get replaced.

I am not sure, whether we should just ignore any exceptions (log them and use an empty string as alternative) in endOfLoop(true), or if we should
require, that one has to
define the variable upfront.

Regards,
 Felix

+        resetLoopCount();
+    }
 }




Reply via email to