jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1828103 - /jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
Date Sat, 31 Mar 2018 12:27:47 GMT
Author: pmouawad
Date: Sat Mar 31 12:27:47 2018
New Revision: 1828103

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

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java?rev=1828103&r1=1828102&r2=1828103&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java Sat Mar 31 12:27:47
2018
@@ -253,28 +253,32 @@ public class JMeterThread implements Run
                     processSampler(sam, null, threadContext);
                     threadContext.cleanAfterSample();
 
+                    boolean lastSampleInError = TRUE.equals(threadContext.getVariables().get(LAST_SAMPLE_OK));
                     // restart of the next loop 
                     // - was requested through threadContext
                     // - or the last sample failed AND the onErrorStartNextLoop option is
enabled
                     if (threadContext.getTestLogicalAction() != TestLogicalAction.CONTINUE
-                            || (onErrorStartNextLoop
-                            && !TRUE.equals(threadContext.getVariables().get(LAST_SAMPLE_OK))))
{
+                            || (onErrorStartNextLoop && !lastSampleInError)) {
                         if (log.isDebugEnabled() && onErrorStartNextLoop
                                 && threadContext.getTestLogicalAction() != TestLogicalAction.CONTINUE)
{
                             log.debug("Start Next Thread Loop option is on, Last sample failed,
starting next thread loop");
                         }
-                        switch (threadContext.getTestLogicalAction()) {
-                            case BREAK_CURRENT_LOOP:
-                                triggerLoopLogicalActionOnParentControllers(sam, threadContext,
JMeterThread::breakOnCurrentLoop);
-                                break;
-                            case START_NEXT_ITERATION_OF_THREAD:
-                                triggerLoopLogicalActionOnParentControllers(sam, threadContext,
JMeterThread::continueOnThreadLoop);
-                                break;
-                            case START_NEXT_ITERATION_OF_CURRENT_LOOP:
-                                triggerLoopLogicalActionOnParentControllers(sam, threadContext,
JMeterThread::continueOnCurrentLoop);
-                                break;
-                            default:
-                                break;
+                        if(onErrorStartNextLoop && !lastSampleInError){
+                            triggerLoopLogicalActionOnParentControllers(sam, threadContext,
JMeterThread::continueOnThreadLoop);
+                        } else {
+                            switch (threadContext.getTestLogicalAction()) {
+                                case BREAK_CURRENT_LOOP:
+                                    triggerLoopLogicalActionOnParentControllers(sam, threadContext,
JMeterThread::breakOnCurrentLoop);
+                                    break;
+                                case START_NEXT_ITERATION_OF_THREAD:
+                                    triggerLoopLogicalActionOnParentControllers(sam, threadContext,
JMeterThread::continueOnThreadLoop);
+                                    break;
+                                case START_NEXT_ITERATION_OF_CURRENT_LOOP:
+                                    triggerLoopLogicalActionOnParentControllers(sam, threadContext,
JMeterThread::continueOnCurrentLoop);
+                                    break;
+                                default:
+                                    break;
+                            }
                         }
                         threadContext.setTestLogicalAction(TestLogicalAction.CONTINUE);
                         sam = null;



Mime
View raw message