Jmeter Test Result Analysis is divided into two parts. The previous article mainly describes how to use assertion in jmeter to classify results. The next article mainly describes how to view the test results after we get the test results.
Anyone who has used LoadRunner knows that LoadRunner itself provides many functions to perform some preliminary analysis on the collected results. For example, you can determine whether the returned results are correct and whether the response time of the request is greater than X seconds. Compared with LoadRunner, jmeter is not so powerful in this regard, but I personally think that for some testers with poor programming Foundation, jmeter is better at ease of use than LoadRunner.
Assertion-assertion is usually a tool used to perform additional verification on each request sampler. The following is an example of several commonly used assertions.
Assume that you want to perform a login stress test. The following are some definitions of Pass:
1. After correct login, you must receive the returned identity verification and user personal information download completion information;
2. The response time cannot exceed 150 milliseconds
3. The returned results cannot be smaller than 750 bytes.
According to the above requirements, we have added the following assertions under the corresponding request sampler.
A. Response assertion
Response field to test -- mark the object to be checked?
Pattern matching rules: indicates the relationship between the checked object and the verified content. It indicates the contains (Inclusion relationship), matches (matching relationship), equals (equal relationship), and not (non-relationship)
Pattern to test -- List of content to be verified
B. Duration assertion
Duration to assert -- maximum allowed Response Time
C. Size assertion
Size to assert -- standard definition of the size of the returned result File
Ii. Result Analysis
After adding the above assertions, I ran a script. The contents of the. jtl file that stores the result are as follows:
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 shoshould 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 shoshould 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 shoshould 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"/, 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 shoshould 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 shoshould have been greater than 750 bytes .,, 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 shoshould 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"/, 2985
We can see that each sampler is judged by assertions, and any non-conforming sampler is marked as false.
In fact, in addition to assertion, jmeter also provides some other useful assertion, which I will not describe here.
If you are interested, take a look at jmeter user manual and try it on your own.
<To be continued>