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

  • 相关阅读:
    uboot配置和编译过程详解
    gcc 与 g++的区别
    ARM交叉编译器GNUEABI、NONE-EABI、ARM-EABI、GNUEABIHF等的区别
    SPI UART区别是什么
    C#获取时间戳的封装方法函数+使用获取当前时间时间戳
    C#中Timer定时器的使用示例
    Linux查看文件夹大小
    Python对象的创建和赋值
    使用mutt自动发送邮件
    pyTorch安装
  • 原文地址:https://www.cnblogs.com/yagao/p/12420982.html
Copyright © 2011-2022 走看看