Author: milamber
Date: Thu Aug 26 23:25:06 2010
New Revision: 989973
URL: http://svn.apache.org/viewvc?rev=989973&view=rev
Log:
Bug 30563 - Thread Group should have a start next loop option on Sample Error
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/AbstractThreadGroup.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/gui/AbstractThreadGroupGui.java
jakarta/jmeter/trunk/xdocs/changes.xml
jakarta/jmeter/trunk/xdocs/images/screenshots/threadgroup.png
jakarta/jmeter/trunk/xdocs/images/screenshots/webtest/threadgroup.png
jakarta/jmeter/trunk/xdocs/images/screenshots/webtest/threadgroup2.png
jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java?rev=989973&r1=989972&r2=989973&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
(original)
+++
jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
Thu Aug 26 23:25:06 2010
@@ -450,6 +450,7 @@ public class StandardJMeterEngine implem
boolean onErrorStopTest = group.getOnErrorStopTest();
boolean onErrorStopTestNow = group.getOnErrorStopTestNow();
boolean onErrorStopThread = group.getOnErrorStopThread();
+ boolean onErrorStartNextLoop = group.getOnErrorStartNextLoop();
String groupName = group.getName();
log.info("Starting " + numThreads + " threads for group " +
groupName + ".");
@@ -459,6 +460,8 @@ public class StandardJMeterEngine implem
log.info("Test will stop abruptly on error");
} else if (onErrorStopThread) {
log.info("Thread will stop on error");
+ } else if (onErrorStartNextLoop) {
+ log.info("Thread will start next loop on error");
} else {
log.info("Thread will continue on error");
}
@@ -475,6 +478,7 @@ public class StandardJMeterEngine implem
jmeterThread.setOnErrorStopTest(onErrorStopTest);
jmeterThread.setOnErrorStopTestNow(onErrorStopTestNow);
jmeterThread.setOnErrorStopThread(onErrorStopThread);
+ jmeterThread.setOnErrorStartNextLoop(onErrorStartNextLoop);
group.scheduleThread(jmeterThread);
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=989973&r1=989972&r2=989973&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
(original)
+++
jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
Thu Aug 26 23:25:06 2010
@@ -694,6 +694,7 @@ sample_scope_variable=JMeter Variable
sampler_label=Label
sampler_on_error_action=Action to be taken after a Sampler error
sampler_on_error_continue=Continue
+sampler_on_error_start_next_loop=Start Next Loop
sampler_on_error_stop_test=Stop Test
sampler_on_error_stop_test_now=Stop Test Now
sampler_on_error_stop_thread=Stop Thread
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties?rev=989973&r1=989972&r2=989973&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
(original)
+++
jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
Thu Aug 26 23:25:06 2010
@@ -610,6 +610,7 @@ sample_scope_variable=Une variable \:
sampler_label=Libell\u00E9
sampler_on_error_action=Action \u00E0 suivre apr\u00E8s une erreur
d'\u00E9chantillon
sampler_on_error_continue=Continuer
+sampler_on_error_start_next_loop=D\u00E9marrer it\u00E9ration suivante
sampler_on_error_stop_test=Arr\u00EAter le test
sampler_on_error_stop_test_now=Arr\u00EAter le test imm\u00E9diatement
sampler_on_error_stop_thread=Arr\u00EAter l'unit\u00E9
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/AbstractThreadGroup.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/AbstractThreadGroup.java?rev=989973&r1=989972&r2=989973&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/AbstractThreadGroup.java
(original)
+++
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/AbstractThreadGroup.java
Thu Aug 26 23:25:06 2010
@@ -45,6 +45,9 @@ public abstract class AbstractThreadGrou
/** Continue, i.e. ignore sampler errors */
public final static String ON_SAMPLE_ERROR_CONTINUE = "continue";
+ /** Start next loop for current thread if sampler error occurs */
+ public final static String ON_SAMPLE_ERROR_START_NEXT_LOOP =
"startnextloop";
+
/** Stop current thread if sampler error occurs */
public final static String ON_SAMPLE_ERROR_STOPTHREAD = "stopthread";
@@ -159,6 +162,15 @@ public abstract class AbstractThreadGrou
}
/**
+ * Check if a sampler error should cause thread to start next loop.
+ *
+ * @return true if thread should start next loop
+ */
+ public boolean getOnErrorStartNextLoop() {
+ return
getPropertyAsString(ThreadGroup.ON_SAMPLE_ERROR).equalsIgnoreCase(ON_SAMPLE_ERROR_START_NEXT_LOOP);
+ }
+
+ /**
* Check if a sampler error should cause thread to stop.
*
* @return true if thread should stop
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java?rev=989973&r1=989972&r2=989973&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
Thu Aug 26 23:25:06 2010
@@ -117,6 +117,8 @@ public class JMeterThread implements Run
private volatile boolean onErrorStopThread;
+ private volatile boolean onErrorStartNextLoop;
+
private volatile Sampler currentSampler;
public JMeterThread(HashTree test, JMeterThreadMonitor monitor,
ListenerNotifier note) {
@@ -238,9 +240,26 @@ public class JMeterThread implements Run
try {
initRun(threadContext);
while (running) {
- Sampler sam;
- while (running && (sam = controller.next()) != null) {
- process_sampler(sam, null, threadContext);
+ Sampler firstSampler = controller.next();
+ Sampler sam = firstSampler;
+ while (running && sam != null) {
+ if (onErrorStartNextLoop) { // if the threadGroup option
is to start next loop when it fails
+
+ if (sam.equals(firstSampler)) { // if it's the start
of an iteration
+ threadContext.getVariables().put(LAST_SAMPLE_OK,
"true");
+ }
+ if (threadContext.getVariables().get(LAST_SAMPLE_OK)
== "true") {
+ process_sampler(sam, null, threadContext);
+ sam = controller.next();
+ } else {
+ while (!sam.equals(firstSampler)) { // while the
thread is NOT on the begining of the tree
+ sam = controller.next();
+ }
+ }
+ } else {
+ process_sampler(sam, null, threadContext);
+ sam = controller.next();
+ }
}
if (controller.isDone()) {
running = false;
@@ -779,8 +798,18 @@ public class JMeterThread implements Run
onErrorStopThread = b;
}
+ /**
+ * Should Thread start next loop on Sampler error?
+ *
+ * @param b -
+ * true or false
+ */
+ public void setOnErrorStartNextLoop(boolean b) {
+ onErrorStartNextLoop = b;
+ }
+
public void setThreadGroup(AbstractThreadGroup group) {
this.threadGroup = group;
}
-}
\ No newline at end of file
+}
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/gui/AbstractThreadGroupGui.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/gui/AbstractThreadGroupGui.java?rev=989973&r1=989972&r2=989973&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/gui/AbstractThreadGroupGui.java
(original)
+++
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/gui/AbstractThreadGroupGui.java
Thu Aug 26 23:25:06 2010
@@ -44,6 +44,8 @@ public abstract class AbstractThreadGrou
// Sampler error action buttons
private JRadioButton continueBox;
+ private JRadioButton startNextLoop;
+
private JRadioButton stopThrdBox;
private JRadioButton stopTestBox;
@@ -114,6 +116,10 @@ public abstract class AbstractThreadGrou
group.add(continueBox);
panel.add(continueBox);
+ startNextLoop = new
JRadioButton(JMeterUtils.getResString("sampler_on_error_start_next_loop")); //
$NON-NLS-1$
+ group.add(startNextLoop);
+ panel.add(startNextLoop);
+
stopThrdBox = new
JRadioButton(JMeterUtils.getResString("sampler_on_error_stop_thread")); //
$NON-NLS-1$
group.add(stopThrdBox);
panel.add(stopThrdBox);
@@ -136,6 +142,8 @@ public abstract class AbstractThreadGrou
stopTestNowBox.setSelected(true);
} else if (te.getOnErrorStopThread()) {
stopThrdBox.setSelected(true);
+ } else if (te.getOnErrorStartNextLoop()) {
+ startNextLoop.setSelected(true);
} else {
continueBox.setSelected(true);
}
@@ -151,6 +159,9 @@ public abstract class AbstractThreadGrou
if (stopThrdBox.isSelected()) {
return AbstractThreadGroup.ON_SAMPLE_ERROR_STOPTHREAD;
}
+ if (startNextLoop.isSelected()) {
+ return AbstractThreadGroup.ON_SAMPLE_ERROR_START_NEXT_LOOP;
+ }
// Defaults to continue
return AbstractThreadGroup.ON_SAMPLE_ERROR_CONTINUE;
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=989973&r1=989972&r2=989973&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Thu Aug 26 23:25:06 2010
@@ -136,6 +136,7 @@ To override the default local language f
<h3>General</h3>
<ul>
+<li>Bug 30563 - Thread Group should have a start next loop option on Sample
Error</li>
</ul>
<h2>Non-functional changes</h2>
Modified: jakarta/jmeter/trunk/xdocs/images/screenshots/threadgroup.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/images/screenshots/threadgroup.png?rev=989973&r1=989972&r2=989973&view=diff
==============================================================================
Binary files - no diff available.
Modified: jakarta/jmeter/trunk/xdocs/images/screenshots/webtest/threadgroup.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/images/screenshots/webtest/threadgroup.png?rev=989973&r1=989972&r2=989973&view=diff
==============================================================================
Binary files - no diff available.
Modified: jakarta/jmeter/trunk/xdocs/images/screenshots/webtest/threadgroup2.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/images/screenshots/webtest/threadgroup2.png?rev=989973&r1=989972&r2=989973&view=diff
==============================================================================
Binary files - no diff available.
Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=989973&r1=989972&r2=989973&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Thu Aug 26
23:25:06 2010
@@ -4611,7 +4611,7 @@ In jmeter.properties, edit "user.classpa
</description>
</component>
-<component name="Thread Group" index="§-num;.9.2" width="411"
height="419" screenshot="threadgroup.png">
+<component name="Thread Group" index="§-num;.9.2" width="609"
height="387" screenshot="threadgroup.png">
<description>
<p>A Thread Group defines a pool of users that will execute a particular test
case against your server. In the Thread Group GUI, you can control the number
of users simulated (num of threads), the ramp up time (how long it takes to
start all the threads), the number of times to perform the test, and
optionally, a start and stop time for the test.</p>
<p>
@@ -4628,6 +4628,7 @@ JMeter does not interrupt samplers which
The possible choices are:
<ul>
<li>Continue - ignore the error and continue with the test</li>
+ <li>Start Next Loop - ignore the error, start next loop and continue
with the test</li>
<li>Stop Thread - current thread exits</li>
<li>Stop Test - the entire test is stopped at the end of any current
samples.</li>
<li>Stop Test Now - the entire test is stopped abruptly. Any current
samplers are interrupted if possible.</li>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]