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

  • 相关阅读:
    LVM磁盘逻辑卷扩容
    confluence 搭建总结
    GTX1050ti安装tensorflow2.0(gpu)
    sublime text 配置 markdown和预览
    Python 程序打包成 exe 可执行文件
    devc++ 配置openCV
    Ubuntu安装sublime text3
    sublime text 配置Miniconda编译环境
    sublime text 配置devc++ 编译环境
    2013-03-27 problem2 A Famous ICPC Team
  • 原文地址:https://www.cnblogs.com/yagao/p/12420982.html
Copyright © 2011-2022 走看看