Chaitanya Chaitanya - 17 days ago 6
Java Question

How to stop the further execution of a Program in Beanshell Assertion

if(!reqAdSize.equalsIgnoreCase(hm.get("ad_size")))
{
Failure = true;
FailureMessage = "Ad Sizes Doesn't Match";
}

if(!reqCur.equalsIgnoreCase(resCur))
{
Failure = true;
FailureMessage = "Request & Responce Currency are NOT same";
}

if(!reqID.equalsIgnoreCase(resID))
{
Failure = true;
FailureMessage = "Request & Responce Id is NOT same";
}


In my jeMter here is my BeanShell Assertion Code all if conditions are satisfying.
In result it will showing the last FailureMessage. I need to stop the execution of code if first condition is true and it will not execute further.



I tried to use the
System.exit(0);
and
exit();
. But jMeter GUI is automatically closing.

What is the method to stop the execution at current line in BeanShell.

Answer

Add return keyword wherever you want to stop the execution of BeanShell code.

Comments