Author: sebb
Date: Fri Apr 24 20:56:33 2009
New Revision: 768416
URL: http://svn.apache.org/viewvc?rev=768416&view=rev
Log:
Add Stop Now to Thread Group and Result Status Action post-processor
Modified:
jakarta/jmeter/trunk/docs/images/screenshots/resultstatusactionhandler.png
jakarta/jmeter/trunk/docs/images/screenshots/threadgroup.png
jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/OnErrorPanel.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultAction.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/testelement/OnErrorTestElement.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/gui/ThreadGroupGui.java
jakarta/jmeter/trunk/xdocs/changes.xml
jakarta/jmeter/trunk/xdocs/images/screenshots/resultstatusactionhandler.png
jakarta/jmeter/trunk/xdocs/images/screenshots/threadgroup.png
jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
Modified:
jakarta/jmeter/trunk/docs/images/screenshots/resultstatusactionhandler.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/resultstatusactionhandler.png?rev=768416&r1=768415&r2=768416&view=diff
==============================================================================
Binary files - no diff available.
Modified: jakarta/jmeter/trunk/docs/images/screenshots/threadgroup.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/threadgroup.png?rev=768416&r1=768415&r2=768416&view=diff
==============================================================================
Binary files - no diff available.
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=768416&r1=768415&r2=768416&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
Fri Apr 24 20:56:33 2009
@@ -440,6 +440,7 @@
int numThreads = group.getNumThreads();
JMeterContextService.addTotalThreads(numThreads);
boolean onErrorStopTest = group.getOnErrorStopTest();
+ boolean onErrorStopTestNow = group.getOnErrorStopTestNow();
boolean onErrorStopThread = group.getOnErrorStopThread();
String groupName = group.getName();
int rampUp = group.getRampUp();
@@ -448,6 +449,8 @@
if (onErrorStopTest) {
log.info("Test will stop on error");
+ } else if (onErrorStopTestNow) {
+ log.info("Test will stop abruptly on error");
} else if (onErrorStopThread) {
log.info("Thread will stop on error");
} else {
@@ -470,6 +473,7 @@
// Set up variables for stop handling
jmeterThread.setEngine(this);
jmeterThread.setOnErrorStopTest(onErrorStopTest);
+ jmeterThread.setOnErrorStopTestNow(onErrorStopTestNow);
jmeterThread.setOnErrorStopThread(onErrorStopThread);
Thread newThread = new Thread(jmeterThread);
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/OnErrorPanel.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/OnErrorPanel.java?rev=768416&r1=768415&r2=768416&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/OnErrorPanel.java
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/OnErrorPanel.java Fri
Apr 24 20:56:33 2009
@@ -36,6 +36,8 @@
private JRadioButton stopTestBox;
+ private JRadioButton stopTestNowBox;
+
private JPanel createOnErrorPanel() {
JPanel panel = new JPanel();
panel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("sampler_on_error_action")));
//$NON-NLS-1$
@@ -55,6 +57,10 @@
group.add(stopTestBox);
panel.add(stopTestBox);
+ stopTestNowBox = new
JRadioButton(JMeterUtils.getResString("sampler_on_error_stop_test_now"));
//$NON-NLS-1$
+ group.add(stopTestNowBox);
+ panel.add(stopTestNowBox);
+
return panel;
}
@@ -74,12 +80,16 @@
}
public void configure(int errorAction) {
+ stopTestNowBox.setSelected(errorAction ==
OnErrorTestElement.ON_ERROR_STOPTEST_NOW);
stopTestBox.setSelected(errorAction ==
OnErrorTestElement.ON_ERROR_STOPTEST);
stopThrdBox.setSelected(errorAction ==
OnErrorTestElement.ON_ERROR_STOPTHREAD);
continueBox.setSelected(errorAction ==
OnErrorTestElement.ON_ERROR_CONTINUE);
}
public int getOnErrorSetting() {
+ if (stopTestNowBox.isSelected()) {
+ return OnErrorTestElement.ON_ERROR_STOPTEST_NOW;
+ }
if (stopTestBox.isSelected()) {
return OnErrorTestElement.ON_ERROR_STOPTEST;
}
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultAction.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultAction.java?rev=768416&r1=768415&r2=768416&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultAction.java
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultAction.java
Fri Apr 24 20:56:33 2009
@@ -56,6 +56,9 @@
SampleResult s = e.getResult();
log.debug(s.getSampleLabel() + " OK? " + s.isSuccessful());
if (!s.isSuccessful()) {
+ if (isStopTestNow()) {
+ s.setStopTestNow(true);
+ }
if (isStopTest()) {
s.setStopTest(true);
}
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=768416&r1=768415&r2=768416&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
Fri Apr 24 20:56:33 2009
@@ -674,6 +674,7 @@
sampler_on_error_action=Action to be taken after a Sampler error
sampler_on_error_continue=Continue
sampler_on_error_stop_test=Stop Test
+sampler_on_error_stop_test_now=Stop Test Now
sampler_on_error_stop_thread=Stop Thread
save=Save
save?=Save?
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java?rev=768416&r1=768415&r2=768416&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
Fri Apr 24 20:56:33 2009
@@ -193,6 +193,8 @@
private boolean stopTest = false; // Should test terminate?
+ private boolean stopTestNow = false; // Should test terminate abruptly?
+
private boolean isMonitor = false;
private int sampleCount = 1;
@@ -755,22 +757,27 @@
}
/**
+ * @return whether to stop the test now
+ */
+ public boolean isStopTestNow() {
+ return stopTestNow;
+ }
+
+ /**
* @return whether to stop this thread
*/
public boolean isStopThread() {
return stopThread;
}
- /**
- * @param b
- */
public void setStopTest(boolean b) {
stopTest = b;
}
- /**
- * @param b
- */
+ public void setStopTestNow(boolean b) {
+ stopTestNow = b;
+ }
+
public void setStopThread(boolean b) {
stopThread = b;
}
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/testelement/OnErrorTestElement.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/testelement/OnErrorTestElement.java?rev=768416&r1=768415&r2=768416&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/core/org/apache/jmeter/testelement/OnErrorTestElement.java
(original)
+++
jakarta/jmeter/trunk/src/core/org/apache/jmeter/testelement/OnErrorTestElement.java
Fri Apr 24 20:56:33 2009
@@ -35,6 +35,8 @@
public final static int ON_ERROR_STOPTEST = 2;
+ public final static int ON_ERROR_STOPTEST_NOW = 3;
+
/* Property name */
public final static String ON_ERROR_ACTION = "OnError.action";
@@ -52,17 +54,18 @@
}
public boolean isContinue() {
- int value = getErrorAction();
- return value == ON_ERROR_CONTINUE;
+ return getErrorAction() == ON_ERROR_CONTINUE;
}
public boolean isStopThread() {
- int value = getErrorAction();
- return value == ON_ERROR_STOPTHREAD;
+ return getErrorAction() == ON_ERROR_STOPTHREAD;
}
public boolean isStopTest() {
- int value = getErrorAction();
- return value == ON_ERROR_STOPTEST;
+ return getErrorAction() == ON_ERROR_STOPTEST;
+ }
+
+ public boolean isStopTestNow() {
+ return getErrorAction() == ON_ERROR_STOPTEST_NOW;
}
}
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=768416&r1=768415&r2=768416&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
Fri Apr 24 20:56:33 2009
@@ -113,6 +113,8 @@
private volatile boolean onErrorStopTest;
+ private volatile boolean onErrorStopTestNow;
+
private volatile boolean onErrorStopThread;
private volatile Sampler currentSampler;
@@ -370,6 +372,9 @@
if (result.isStopTest() || (!result.isSuccessful() &&
onErrorStopTest)) {
stopTest();
}
+ if (result.isStopTestNow() || (!result.isSuccessful() &&
onErrorStopTestNow)) {
+ stopTestNow();
+ }
} else {
compiler.done(pack); // Finish up
}
@@ -737,6 +742,16 @@
}
/**
+ * Should Test stop abruptly on sampler error?
+ *
+ * @param b -
+ * true or false
+ */
+ public void setOnErrorStopTestNow(boolean b) {
+ onErrorStopTestNow = b;
+ }
+
+ /**
* Should Thread stop on Sampler error?
*
* @param b -
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java?rev=768416&r1=768415&r2=768416&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java
Fri Apr 24 20:56:33 2009
@@ -76,6 +76,9 @@
/** Stop test (all threads) if sampler error occurs */
public final static String ON_SAMPLE_ERROR_STOPTEST = "stoptest";
+ /** Stop test NOW (all threads) if sampler error occurs */
+ public final static String ON_SAMPLE_ERROR_STOPTEST_NOW = "stoptestnow";
+
// @GuardedBy("this")
private int numberOfThreads = 0; // Number of active threads in this group
@@ -311,4 +314,13 @@
return
getPropertyAsString(ThreadGroup.ON_SAMPLE_ERROR).equalsIgnoreCase(ON_SAMPLE_ERROR_STOPTEST);
}
+ /**
+ * Check if a sampler error should cause test to stop now.
+ *
+ * @return true if test (all threads) should stop immediately
+ */
+ public boolean getOnErrorStopTestNow() {
+ return
getPropertyAsString(ThreadGroup.ON_SAMPLE_ERROR).equalsIgnoreCase(ON_SAMPLE_ERROR_STOPTEST_NOW);
+ }
+
}
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/gui/ThreadGroupGui.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/gui/ThreadGroupGui.java?rev=768416&r1=768415&r2=768416&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/gui/ThreadGroupGui.java
(original)
+++
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/gui/ThreadGroupGui.java
Fri Apr 24 20:56:33 2009
@@ -81,6 +81,8 @@
private JRadioButton stopTestBox;
+ private JRadioButton stopTestNowBox;
+
public ThreadGroupGui() {
super();
init();
@@ -119,15 +121,24 @@
}
private void setSampleErrorBoxes(ThreadGroup te) {
- stopTestBox.setSelected(te.getOnErrorStopTest());
- stopThrdBox.setSelected(te.getOnErrorStopThread());
- continueBox.setSelected(!te.getOnErrorStopThread() &&
!te.getOnErrorStopTest());
+ if (te.getOnErrorStopTest()) {
+ stopTestBox.setSelected(true);
+ } else if (te.getOnErrorStopTestNow()) {
+ stopTestNowBox.setSelected(true);
+ } else if (te.getOnErrorStopThread()) {
+ stopThrdBox.setSelected(true);
+ } else {
+ continueBox.setSelected(true);
+ }
}
private String onSampleError() {
if (stopTestBox.isSelected()) {
return ThreadGroup.ON_SAMPLE_ERROR_STOPTEST;
}
+ if (stopTestNowBox.isSelected()) {
+ return ThreadGroup.ON_SAMPLE_ERROR_STOPTEST_NOW;
+ }
if (stopThrdBox.isSelected()) {
return ThreadGroup.ON_SAMPLE_ERROR_STOPTHREAD;
}
@@ -280,6 +291,10 @@
group.add(stopTestBox);
panel.add(stopTestBox);
+ stopTestNowBox = new
JRadioButton(JMeterUtils.getResString("sampler_on_error_stop_test_now")); //
$NON-NLS-1$
+ group.add(stopTestNowBox);
+ panel.add(stopTestNowBox);
+
return panel;
}
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=768416&r1=768415&r2=768416&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Fri Apr 24 20:56:33 2009
@@ -242,7 +242,7 @@
<li>Bug 46636 - rmi ports</li>
<li>Mirror server now supports "X-Sleep" header - if this is set, the
responding thread will wait for the specified number of milliseconds</li>
<li>Make some samplers interruptible: HTTP (both), SoapSampler, FTPSampler</li>
-<li>Test Action now supports "Stop Now" action</li>
+<li>Test Action now supports "Stop Now" action, as do the Thread Group and
Result Status Post Processor elements</li>
<li>The Menu items Stop and Shutdown now behave better. Shutdown will now wait
until all threads exit.
In GUI mode it can be cancelled and Stop run instead.
Stop now reports if some threads will not exit, and exits if running in
non-GUI mode</li>
Modified:
jakarta/jmeter/trunk/xdocs/images/screenshots/resultstatusactionhandler.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/images/screenshots/resultstatusactionhandler.png?rev=768416&r1=768415&r2=768416&view=diff
==============================================================================
Binary files - no diff available.
Modified: jakarta/jmeter/trunk/xdocs/images/screenshots/threadgroup.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/images/screenshots/threadgroup.png?rev=768416&r1=768415&r2=768416&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=768416&r1=768415&r2=768416&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Fri Apr 24
20:56:33 2009
@@ -3931,11 +3931,21 @@
</component>
-<component name="Result Status Action Handler" index="§-num;.8.3"
width="697" height="132" screenshot="resultstatusactionhandler.png">
+<component name="Result Status Action Handler" index="§-num;.8.3"
width="435" height="146" screenshot="resultstatusactionhandler.png">
<description>This test element allows the user to stop the thread or the
whole test if the relevant sampler failed.
</description>
<properties>
<property name="Name" required="">Descriptive name for this element that is
shown in the tree.</property>
+ <property name="Action to be taken after a Sampler error">
+ Determines what happens if a sampler error occurs, either because the
sample itself failed or an assertion failed.
+ The possible choices are:
+ <ul>
+ <li>Continue - ignore the error 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>
+ </ul>
+ </property>
</properties>
</component>
@@ -4068,7 +4078,7 @@
<p>In jmeter.properties, edit "user.classpath" to include additional
libraries.</p></description>
</component>
-<component name="Thread Group" index="§-num;.9.2" width="305"
height="390" screenshot="threadgroup.png">
+<component name="Thread Group" index="§-num;.9.2" width="411"
height="419" 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>
@@ -4080,9 +4090,19 @@
<properties>
<property name="Name" required="">Descriptive name for this element
that is shown in the tree.</property>
+ <property name="Action to be taken after a Sampler error">
+ Determines what happens if a sampler error occurs, either because the
sample itself failed or an assertion failed.
+ The possible choices are:
+ <ul>
+ <li>Continue - ignore the error 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>
+ </ul>
+ </property>
<property name="Number of Threads" required="Yes">Number of users to
simulate.</property>
<property name="Ramp-up Period" required="Yes">How long JMeter should
take to get all the threads started. If there are 10 threads and a ramp-up
time of 100 seconds, then each thread will begin 10 seconds after the previous
thread started, for a total time of 100 seconds to get the test fully up to
speed.</property>
- <property name="Loop Count" required="No">Number of times to perform
the test case. Alternatively, "forever" can be selected causing the test to
run until manually stopped.</property>
+ <property name="Loop Count" required="Yes, unless forever is
selected">Number of times to perform the test case. Alternatively, "forever"
can be selected causing the test to run until manually stopped.</property>
<property name="Start Time" required="No">If the scheduler checkbox is
selected, one can choose an absolute start time. When you start your test,
JMeter will wait until the specified start time to begin testing.
Note: the Startup Delay field over-rides this - see below.
</property>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]