首先必须给beanshell断言添加FailureMessage
if(${TotalClient_SS}+2!=${TotalClient_SS2})
{
Failure=true; FailureMessage="TotalClient_SS=${TotalClient_SS},TotalClient_SS2=${TotalClient_SS2},Expected:TotalClient_SS+2==TotalClient_SS2,Actually:${TotalClient_SS}+2!=${TotalClient_SS2}";
}
添加了FailureMessage,在Jmeter界面运行时,如果beanshell断言校验失败,在结果树中就会有这样的信息:
Assertion error: false
Assertion failure: true
Assertion failure message: TotalClient_SS=0,TotalClient_SS2=1,Expected:TotalClient_SS+2==TotalClient_SS2,Actually:0+2!=1
之后,通过ANT执行测试用例,生成的报告就会有beanshell断言失败的详细信息: