我在脚本中添加了bean shell断言。
它显示所有情况的失败消息,即使它已通过。
以下是我的脚本
String response = new String(ResponseData);
if(${BoolValue} == true)
{
Failure = !(response.contains("growth"));
FailureMessage = "Projection values is showing in the response data for non-skill reports";
}
if(${BoolValue} == false)
{
Failure = (response.contains("growth"));
FailureMessage = "Projection values is not showing in the response data for skill reports";
}
我只有在案件失败时才需要收到失败消息。请告诉我,怎么做?
答案 0 :(得分:1)
在失败前检查失败消息分配:
String response = new String(ResponseData);
if(${BoolValue} == true)
{
Failure = !(response.contains("growth"));
if (Failure) {
FailureMessage = "Projection values is showing in the response data for non-skill reports";
}
}
if(${BoolValue} == false)
{
Failure = (response.contains("growth"));
if (Failure) {
FailureMessage = "Projection values is not showing in the response data for skill reports";
}
}
BTW使用应该使用变量名称的Java约定应该以小写字母开头:failure
而不是Failure
。