I want to do a Assertion failure in JSR223 Sampler based on the values i detected in 2 Post processors above. I tried importing AssertionResult in JSR223 Sampler but it is unable to invoke the method.
Getting the following error in log:
javax.script.ScriptException: Sourced file: inline evaluation of: SampleResult.setIgnore(); import org.apache.jmeter.threads.JMeterContext.TestLog . . . '' : Cannot reach instance method: setFailure( boolean ) from static context: org.apache.jmeter.assertions.AssertionResult : at Line: 24 : in file: inline evaluation of:
SampleResult.setIgnore(); import org.apache.jmeter.threads.JMeterContext.TestLog . . . '' : AssertionResult .setFailure ( true )
Is this a right way to call this method?
JSR223 Sampler
SampleResult.setIgnore();
import org.apache.jmeter.threads.JMeterContext.TestLogicalAction;
import org.apache.jmeter.assertions.AssertionResult;
//Final Response Assertion
String s1 = "N";
String s2 = "N";
if( ${__isVarDefined(s_check)} == true )
{
s1 = vars.get("s_check");
}
if( ${__isVarDefined(s_check_1)} == true )
{
s2 = vars.get("s_check_1");
}
if( (s1 == "false" && s2 == "false") || (s1 == "false" && s2 == "N") || (s1 == "N" && s2 == "false") )
{
AssertionResult.setFailure(true); //NOT WORKING
AssertionResult.setFailureMessage("accountID page is not loaded"); //NOT WORKING
ctx.setTestLogicalAction(TestLogicalAction.START_NEXT_ITERATION_OF_THREAD); //WORKING
}