title: How to terminate the execution of Jmeter script/test when assertion is failed - (GUI run)
body: <p>I have assertion <em>JSR223 Assertion</em> sampler with following code:</p>
  <pre><code>import groovy.json.JsonSlurper;
  import com.fasterxml.jackson.databind.ObjectMapper;
  
  JsonSlurper JSON = new JsonSlurper ();
  ObjectMapper mapper = new ObjectMapper();
  
  def jsonResponse = JSON.parseText(prev.getResponseDataAsString());
  def hasError = jsonResponse.hasError
  
   
  
  if (hasError) {
      AssertionResult.setFailure(true);
   
  }
  </code></pre>
  <p>How to stop the execution from the assertion sampler based on the <code>vars.get(&quot;JMeterThread.last_sample_ok&quot;)</code> variable, inside in the Assertion sampler, without ading additional elements to the script?</p>