You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2017/10/23 12:08:24 UTC

svn commit: r1813001 - in /jmeter/trunk: src/components/org/apache/jmeter/assertions/JSR223Assertion.java xdocs/changes.xml

Author: pmouawad
Date: Mon Oct 23 12:08:24 2017
New Revision: 1813001

URL: http://svn.apache.org/viewvc?rev=1813001&view=rev
Log:
Bug 61534 - Convert AssertionError to a failed assertion in the JSR223Assertion allowing users to use assert in their code
Patch by Felix Schumacher
Bugzilla Id: 61534

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/assertions/JSR223Assertion.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=1813001&r1=1813000&r2=1813001&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/assertions/JSR223Assertion.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/assertions/JSR223Assertion.java Mon Oct 23 12:08:24 2017
@@ -44,7 +44,12 @@ public class JSR223Assertion extends JSR
             Bindings bindings = scriptEngine.createBindings();
             bindings.put("SampleResult", response);
             bindings.put("AssertionResult", result);
-            processFileOrScript(scriptEngine, bindings);
+            try {
+                processFileOrScript(scriptEngine, bindings);
+            } catch (AssertionError ae) {
+                result.setFailure(true);
+                result.setFailureMessage(ae.toString());
+            }
             result.setError(false);
         } catch (IOException | ScriptException e) {
             log.error("Problem in JSR223 script: {}", getName(), e);

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1813001&r1=1813000&r2=1813001&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Mon Oct 23 12:08:24 2017
@@ -101,6 +101,7 @@ Summary
     <li><bug>60213</bug>Boundary based extractor</li>
     <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>61534</bug>Convert AssertionError to a failed assertion in the JSR223Assertion allowing users to use assert in their code</li>
 </ul>
 
 <h3>Functions</h3>