1. parameterization
The recording script has the login operation, need to enter the user name and password, if the system does not allow the same user name and password to log in at the same time, or want to better simulate multiple users to log into the system.
At this point, you need to parameterize the username and password so that each virtual user is accessed using a different user name and password.
There are two ways of JMeter parameterization
preparatory work
A) record a script (which can be recorded with the Badboy tool), open in JMeter, and find a page with a user name and password. As follows:
b) We need "parameterized" data, write three user name and password in Notepad, save as. txt format file , Note: User name and password is one by one corresponding, intermediate user comma (,) separated.
Two ways to Parameterize(1) How to use the function assistant
A) Click on the menu bar "Options"----> Function Assistant dialog box to see: CSV file column number is starting from 0, the first column 0, the second column 1, the third column 2, and so on
b) Copy the generated parametric function, open the landing Request page, in the right parameterization to find the field we want to parameterize, here the user name and password is parameterized, the first column is the user name, the column number is 0, the second column is a password, the column number is 1; modify the corresponding parameterized field column number in the function .
Well, now that our parameterization is complete, the script will call us the D:\JMeter\Login.txt file, the first column is the user, and the second column is the password.
(2) with the configuration element in the JMeter (CSV Data Set Config)
A) Select the thread group, right-click, add-config component-csv Data set Config
Description
Filename---parameter entry file
File Encoding encoding of---files, set to UTF-8
Vaiable Names The parameter items represented by the columns in the---file, separated by commas, and the name of the parameter item should be the same as the parameter entry in the HTTP request.
Delimiter---If the file is separated by commas, fill in the comma, or fill in \ t If you are using tab,(if the text file is in CSV format, the default is comma delimited)
Recycle on EOF? ---true= when reading a file to the end, read the file again
false= stop reading a file when it is read to the end
Stop thread on EOF? ---when recycle on EOF is false, the process is stopped when the file is read to the end, which is meaningless when recycle on EOF is True
b) Use the variables you just defined
At this point, the two methods of parameterization are finished.
It is necessary to note that the function helper method is weaker than the CSV control method parameterization, and the CSV control method is recommended.
2. Assertions
JMeter also has checkpoints like LR, this article introduces how to implement the checkpoint JMeter.
The checkpoint inside the JMeter is done by adding assertions.
As mentioned above, we have parameterized the user name and password, then how to determine if JMeter has correctly called T.dat inside the file. Of course, we can view it from the results chart. But I still want to check it out in the "sign in" area.
(1) Add response assertion , right click on our "Login" page----> Add----> Assert----> Response Assertion
(2) Setting the response assertion
Assertions can be added with multiple assertions together, and assertions can also be made using parameterized methods to make dynamic judgments.
(3) Add the assertion result , right click on our "Login" page----> Add----> Listener----> Assert results
Add a "View results tree" Right-click on our "Sign in" page----> Add----> Listener----> View results Tree
Set up 3 users in the thread group and click Run Run.
(4) View Assertion Results
A), success such as:
b), if the assertion fails, such as:
Note: A typical success will only display one row of data, otherwise a single row will be displayed. at this point, the checkpoint setup is complete.
3. Meeting Point
JMeter also has a collection point like LR, this article introduces how to implement the JMeter collection point .
The assembly point inside the JMeter is completed by adding a timer.
Note: The location of the meeting point must precede the sample.
Simple to understand, although our "performance test" is understood as "multiuser concurrency test", but the real concurrency is not exist, in order to more realistic implementation of this idea, we can set the point where the pressure is needed, where the user and password, each to enter the user name and password where the login, All virtual users wait for each other, and then they are visited together.
(1) Next script created, right click on thread Group----> Timer---->Synchronizing Timer
In this way, a "collection point" is added, which sets the set point, setting the delay time (in milliseconds) .
(2) The list after we've added it looks like this.
Found no, our rendezvous point position is not correct, should be in front of the login. How do you do that?
Simple method: Drag the collection point, move synchronizing timer directly to the front of the login.
The collection point has been added to completion.
In conclusion, the method of JMeter, assertion and collection point is added.
JMeter Learning (iv) parameterization, assertions, set points