jmeter断言之BeanShell断言

1、添加BeanShell断言,在Script下面写断言脚本,常用的BeanShell脚本如下:

if(!SampleResult.getResponseCode().equals("200")){
    SampleResult.setSuccessful(false);
    log.error(SampleResult.getResponseCode());
}else{
    SampleResult.setSuccessful(true);
    log.info("测试成功!");
}

2、添加断言结果,运行脚本

posted @ 2017-08-07 16:37  虞秀权  阅读(705)  评论(0编辑  收藏  举报