Reputation: 699
I am trying to fail a sampler in case the script logically is not right, this is my script:
for(int i=0;i<suggestions.length();i++){
JSONObject item = (JSONObject)suggestions.getJSONObject(i);
JSONObject params = item.getJSONObject("params");
if(i==0){
msg = getMessage(item,i,suggestions);
System.out.println(msg+" "+ i);
if(!msg.equals("Hi, I just started a run at home")){
res = result(res);
System.out.println(res);
}
}
Now result()
function suppose to get failure result string I want to be able to fail the sampler in case the result()
function output is "fail".
Upvotes: 1
Views: 954
Reputation: 371
Try http://jmeter.apache.org/usermanual/component_reference.html#Response_Assertion. You can check the String response here. It is better to check here than hard-coding.
Upvotes: 1