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

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

jmeter断言之BeanShell断言

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

jmeter断言之BeanShell断言

相关文章: