Author: fschumacher
Date: Thu Jan 25 21:22:58 2018
New Revision: 1822229
URL: http://svn.apache.org/viewvc?rev=1822229&view=rev
Log:
Convert AssertionError to a failed assertion for all kind of assertions.
Fixing a regression introduced in 3.2. ThreadDeath has not to be catched
anymore,
as we are not using Error in the catch clause (which was the case before
r1775911
that introduced this regression).
Bugzilla Id: 61534
Modified:
jmeter/trunk/src/components/org/apache/jmeter/assertions/JSR223Assertion.java
jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
jmeter/trunk/xdocs/changes.xml
Modified:
jmeter/trunk/src/components/org/apache/jmeter/assertions/JSR223Assertion.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/assertions/JSR223Assertion.java?rev=1822229&r1=1822228&r2=1822229&view=diff
==============================================================================
---
jmeter/trunk/src/components/org/apache/jmeter/assertions/JSR223Assertion.java
(original)
+++
jmeter/trunk/src/components/org/apache/jmeter/assertions/JSR223Assertion.java
Thu Jan 25 21:22:58 2018
@@ -46,12 +46,7 @@ public class JSR223Assertion extends JSR
Bindings bindings = scriptEngine.createBindings();
bindings.put("SampleResult", response);
bindings.put("AssertionResult", result);
- try {
- processFileOrScript(scriptEngine, bindings);
- } catch (AssertionError ae) { // NOSONAR We don't want to log the
exception as it is handled
- result.setFailure(true);
- result.setFailureMessage(ae.toString());
- }
+ processFileOrScript(scriptEngine, bindings);
result.setError(false);
} catch (IOException | ScriptException e) {
log.error("Problem in JSR223 script: {}", getName(), e);
@@ -60,7 +55,7 @@ public class JSR223Assertion extends JSR
}
return result;
}
-
+
@Override
public Object clone() {
return super.clone();
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=1822229&r1=1822228&r2=1822229&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java Thu Jan
25 21:22:58 2018
@@ -811,8 +811,11 @@ public class JMeterThread implements Run
AssertionResult assertionResult;
try {
assertionResult = assertion.getResult(result);
- } catch (ThreadDeath e) {
- throw e;
+ } catch (AssertionError e) {
+ log.debug("Error processing Assertion.", e);
+ assertionResult = new AssertionResult("Assertion failed! See log
file (debug level, only).");
+ assertionResult.setFailure(true);
+ assertionResult.setFailureMessage(e.toString());
} catch (JMeterError e) {
log.error("Error processing Assertion.", e);
assertionResult = new AssertionResult("Assertion failed! See log
file.");
Modified: jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1822229&r1=1822228&r2=1822229&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Thu Jan 25 21:22:58 2018
@@ -210,7 +210,7 @@ itself does not have to be edited anymor
<li><bug>61644</bug>HTTP Cache Manager: "Use Cache-Control/Expires header
when processing GET requests" should be checked by default</li>
<li><bug>61645</bug>Response Assertion: Add ability to assert on Request
Data</li>
<li><bug>51140</bug>Response Assertion: add ability to set a specific
error/failure message that is later shown in the Assertion Result. Contributed
by Ubik Load Pack (support at ubikloadpack.com)</li>
- <li><bug>61534</bug>Convert AssertionError to a failed assertion in the
JSR223Assertion allowing users to use assert in their code</li>
+ <li><bug>61534</bug>Convert AssertionError to a failed assertion, allowing
users to use assert in their code. Fixing a regression introduced in 3.2</li>
<li><bug>61756</bug>Extractors: Improve label name "Reference name" to
make it clear what it makes</li>
<li><bug>61758</bug><code>Apply to:</code> field in Extractors,
Assertions: When entering a value in <code>JMeter Variable Name</code>, the
radio box <code>JMeter Variable Name</code> should be selected by default.
Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
<li><bug>61846</bug>Scoped Assertion should follow same order of
evaluation as Post Processors</li>