二、结果分析
添加了以上的Assertions后,我运行了一次脚本。以下是存放结果的.jtl文件的内容:
timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,Latency
11/04/08 13:22:03,172,Do Login,200,OK,Thread Group 1-1,text,false,The operation lasted too long: It took 172 milliseconds, but should not have lasted longer than 150 milliseconds.,835,172
11/04/08 13:22:03,156,Do Login,200,OK,Thread Group 1-2,text,false,Test failed: text expected to contain /loginMsg="OK"/,633,156
11/04/08 13:22:03,156,Do Login,200,OK,Thread Group 1-3,text,false,The operation lasted too long: It took 156 milliseconds, but should not have lasted longer than 150 milliseconds.,839,156
11/04/08 13:22:03,156,Do Login,200,OK,Thread Group 1-4,text,false,The operation lasted too long: It took 156 milliseconds, but should not have lasted longer than 150 milliseconds.,836,156
11/04/08 13:22:03,78,Do Login,200,OK,Thread Group 1-5,text,true,,779,78
11/04/08 13:22:03,63,Do Login,200,OK,Thread Group 1-7,text,false,Test failed: text expected to contain /loginMsg="OK"/,570,63
11/04/08 13:22:03,141,Do Login,200,OK,Thread Group 1-6,text,false,The result was the wrong size: It was 721 bytes, but should have been greater than 750 bytes.,721,141
11/04/08 13:22:03,78,Do Login,200,OK,Thread Group 1-9,text,false,The result was the wrong size: It was 724 bytes, but should have been greater than 750 bytes.,724,78
11/04/08 13:22:03,204,Do Login,200,OK,Thread Group 1-10,text,false,The operation lasted too long: It took 204 milliseconds, but should not have lasted longer than 150 milliseconds.,1137,204
11/04/08 13:22:03,2985,Do Login,200,OK,Thread Group 1-8,text,false,Test failed: text expected to contain /loginMsg="OK"/,570,2985
我们可以看到,每一个Sampler都会经过Assertions的判断,只要有一个不符合条件的都会标示为False。
其实除了以上讲到Assertion,jmeter还提供了其他一些比较实用的Assertion,而我在这也不一一介绍了。
有兴趣的可以看一下jmeter的user manual,然后再自己动手试验一下。 <待续>
相关文章: