Parametric is to some input parameters to the script in place, in the range specified in the rule parameters and run the script, the script at run time may be required
Select different parameter values as input. This test is called the data driver in automation, the range parameter is referred to as data pool (Data Pool)
Preparation of test scripts
1. Add thread group, the parameter settings as shown:
2. Add thread group member -HTTP Configuration Request Defaults: http protocol enter the server name or IP port number input httpbin.org Input: 80
Parametric: preprocessor - User Parameters
Add the pre-processor 1. The thread group - User Parameters
Add variables username
, password
and the corresponding three values
Add request the sampler 2. Thread group -HTTP
Methods GET, enter the path/get
Parameters: username
=> variable parameters associated with the user${username}
Parameters: password
=> variable parameters associated with the user${password}
3. HTTP request to add the tree to see the results, run the script
4. The tree view request by viewing the results, three parameters were requested variables username
and password
the three values
Parametric: configurable elements - User-defined Variables
1. Add the thread group element arranged - User-defined Variables
Add a variable user
value user_var
and variable pwd
valuepwd_var
Add request the sampler 2. Thread group -HTTP
Methods GET, enter the path/get
Parameters: username
=> variable parameters associated with the user${user}
Parameters: password
=> variable parameters associated with the user${pwd}
3. HTTP request to add the tree to see the results, run the script
4. The tree view request, the result by looking at the parameters username
and password
the values of the request user_var
andpwd_var
NOTE: configuration elements - user-defined variable parameter values defined in the value of the change can not occur during the execution of the test plan, so
Generally only the test program is not required with the iteration parameters (only takes one parameter) changed the settings here
Parametric: configuration data file element disposed -CSV
1. Add test data
New data.dat document on a computer, recording three sets of data - user names, passwords, separated by a half-width comma
Add configuration settings file data element 2. -CSV thread group
File name: refers to the directory where you saved the file information can be relative or absolute path
File Encoding: Select utf-8
Variable name: variable name corresponding to the parameter file of each column, an identifier for later reference
Ignore the first line: We parameterization file, the first line of test data that does not need to ignore the first line, so choose false
Separator: consistent with the parameters agreed to file, parameter file using the comma, we are here to fill comma, parameter files
Allow quotation marks: whether to allow the data to be wrapped cvs quotes, selected false
Encounters end of file cycle again:? Here select True, if we have three rows of data, but there are four threads, the first four threads will continue to use the first row of data circulating Login
Encounter EOF stop the thread:? Here select False, not end
Thread shared mode: 4 modes, all threads, the current thread group, the current thread, custom
Add request the sampler 3. Thread group -HTTP
Methods GET, enter the path/get
Parameters: username
=> variable parameters associated with the user${user_csv}
Parameters: password
=> variable parameters associated with the user${pwd_csv}
4. HTTP request to add the tree to see the results, run the script
The tree view request by looking at the results, three parameters were requested variables user_csv
and pwd_csv
the three values
Parameterization: function assistant _CSVRead
Add Function Assistant -CSVRead under 1. thread group
To get the value of CSV file | * Alias: The value of file, write the absolute path
CSV file column number | next | * alias: file start column number, 0 represents the first row, second column represents, and so on
Copy and paste function strings: parameterized parameters, the copy can be used, such as here, "$ {__ CSVRead (G: \ parametric \ data.dat, 0}" represents my use
Username, "$ {__ CSVRead (G: \ parametric \ data.dat, 1)}" represents the password
Add request the sampler 3. Thread group -HTTP
Methods GET, enter the path/get
Parameters: username
=> variable parameters associated with the user ${__CSVRead(G:\参数化\data.dat,0}
Parameters: password
=> variable parameters associated with the user ${__CSVRead(G:\参数化\data.dat,1}
4. HTTP request to add the tree to see the results, run the script
The tree view request by looking at the results, three parameters were requested variables ${__CSVRead(G:\参数化\data.dat,0}
and${__CSVRead(G:\参数化
\data.dat,1}
Three sets of values