JMeter also has parameters like LR, this article introduces how to implement the parameterization of JMeter.
parameterization : The recording script has a login operation, you need to enter a 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.
First, prepare the script, test the data
1, record a script (can be recorded with the Badboy tool), open in JMeter, find a user name and Password page. As follows:
2, we need "parameterized" data, write five user name and password in Notepad, save the file in. dat format, the coding problem is strict when using CSV Data Set config, and Notepad is saved as modified code UTF-8. Note that the user name and password are one by one corresponding to the intermediate user comma (,) separated.
I put this file under my (C:\JmeterWorkSpace\t.dat) path.
Second, the parameterization of
Here are two ways to parameterize: function helper, CSV Data Set Config.
1, with the help of function assistant way
A, click the menu bar "Options"----> Function Assistant dialog box, see: The 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 parameterization function, open the landing Request page, in the right of the 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 the 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 T.dat file below the C:\JmeterWorkSpace disk, the first column is the user, and the second column is the password.
2. Using the configuration element in JMeter (CSV Data Set Config)
A, select Thread group, right-click, add-Configure 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
Note: Here I would like to speak in plain language about the association of the recycle on EOF with the stop thread on EOF results
Recycle on EOF: At the end of the file, whether to iterate through parameters, options: True and False
Stop thread on EOF: At the end of the file, whether to stop threads, options: True and False
When recycle on EOF is selected true, stop thread on EOF chooses true and false without any meaning, in layman's words, in front of the control of the nonstop loop read, back again to let stop or run no meaning
When recycle on EOF selects Flase, Stop thread on EOF chooses True, thread 4, Parameter 3, then only 3 times requested
When recycle on EOF selects Flase, the Stop thread on EOF chooses Flase, thread 4, Parameter 3, then 4 times is requested, but 4th time no arguments are desirable, not allowed to loop, so 4th request error
Case Download: Demo
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.
Let's look at the different parameterization of the LoadRunner:
1. The first line of the JMeter parameter file has no column name
2, note here is the parameter file encoding, you can use Notepad Save as to modify the code (coding problems in the use of CSV Data Set config parameterized when the strict requirements)
3, JMeter parameterization settings do not loadrunner good, it is dependent on the thread settings (only the CSV Data set config Parameterization method only)
JMeter Thematic Series (IV.) parameterization