Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/391.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 仅用于jmeter中失败案例的失败消息_Java_Netbeans_Jmeter_Assertions_Beanshell - Fatal编程技术网

Java 仅用于jmeter中失败案例的失败消息

Java 仅用于jmeter中失败案例的失败消息,java,netbeans,jmeter,assertions,beanshell,Java,Netbeans,Jmeter,Assertions,Beanshell,我在脚本中添加了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-ski

我在脚本中添加了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";
}

只有当案例失败时,我才需要获取失败消息。请告诉我,如何执行此操作?

在分配失败消息之前检查失败:

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";
    }
}
顺便说一句,应该使用Java约定,变量名应该以小写字母开头:
failure
而不是
failure