zoukankan      html  css  js  c++  java
  • Jmeter的BeanShell断言

    1、什么是BeanShell断言?

          BeanShell断言可以使用beanshell脚本来执行断言检查,可以用于更复杂的个性化需求,使用更灵活,功能更强大,但是要能够熟练使用beanshell脚本。

          在这里除了可以使用beanshell的内置变量外,主要通过Failure和FailureMessage来设置断言结果。

    Failure = false;-----表示断言成功,

    FailureMessage = "……"; ----自定义的成功信息

    Failure = true;-----表示断言失败,

    FailureMessage = "……";-----自定义的失败信息。
          下面看一个简单的示例:

    其中脚本内容如下:

    if ("200".equals(""+ResponseCode) == false )
    {
    // 响应码不等于200时,设置断言失败,并输出失败信息
    Failure=true ;
    FailureMessage ="Response code was not a 200 response code it was " + ResponseCode + "." ;
    print ( "the return code is " + ResponseCode); // this goes to stdout
    log.warn( "the return code is " + ResponseCode); // this goes to the JMeter log file
    } else {
    // 响应码等于200时,设置断言成功,并输出成功信息
    Failure=false;
    FailureMessage = "Return true, and the response code was " + ResponseCode;
    }
    }
    ————————————————
    版权声明:本文为CSDN博主「媛测」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/lijing742180/article/details/81157947

  • 相关阅读:
    26.angularJS $routeProvider
    25.内置API
    24.路由
    iOS开发网络篇—数据安全
    从idea到ipo
    CentOS下php安装mcrypt扩展
    iOS客户端学习之AES加密
    PHP 标准AES加密算法类
    使用php扩展mcrypt实现AES加密
    base64的作用
  • 原文地址:https://www.cnblogs.com/yagao/p/12420982.html
Copyright © 2011-2022 走看看