Reputation: 494
Given below code snippet i am using in beanshell assertion to verify the soap /json responses . if the both values (names) are not equals my bean shell assertion show failure message as given below(i could see the assertion failure in view result section) . I would like to display the successful message if bean shell assertion pass or condition pass ? Can anyone advise how to show the successful message in view result section?
String soap_firstName=vars.get("soap_firstName");
String json_firstName=vars.get("json_firstName");
if(!soap_firstName.equals(json_firstName)){
Failure=true;
FailureMessage = "SOAP first name not match with Json first name ";
} else{
Failure=false;
//TODO: send the result to assertion message section -> "SOAP and Json first name are equal";
}
Upvotes: 2
Views: 9052
Reputation: 15400
In the beanshell assertion, you can update only below objects.
You can use either log object to log the messages or SampleResult to update the ResponseMessage.
log.info("PASSED");
Or
SampleResult.setResponseMessage("PASSED");
The result will look like this
Follow up:
We do not have any property to show a success message for the Assertion Results listener. It seems to make sense for me to show only a failure message when things do not go as expected. Otherwise, It is assumed that it is Success.
Upvotes: 2