__csvread use of common functions of JMeter

Source: Internet
Author: User

The __csvread function is used to parameterize the script, and the __csvread function can be considered when different parameter values are required for the various variables in the script.

Take the login username, password as an example: in the actual stress test, we need to simulate the use of different user concurrent access system, we need to parameterize the user name, password in the script, the following describes how to use the Csvread function:

1. Prepare the parameter Value list list, file format: CSV or TXT file, which holds variables to read the parameter values, each variable is separated by commas. Each row represents each set of parameter values, and each column represents the same variable;

If you are preparing 10 different users, the file name user Parameter.txt, whose username and password are as follows:

[Email protected],12
[Email protected],123
[Email protected],hai123
[Email PROTECTED],12ABC
[Email Protected],23dcs
[Email protected],ed12q
[Email Protected],jumper
[Email protected],poi2qwe
[Email Protected],122dewq
[Email protected],123dew23

2. After preparing the parameter Value list list, open JMeter function assistant, select Csvread function, generate function;

In JMeter Options--Select the Function Assistant dialog box and select the Csvread function or use the shortcut key Ctrl+f Open,

which

CSV file to get values from | *alias: Indicates the path of the file to be read, which should be an absolute path (e.g., D:\Software\jmeter\User parameter.txt)

CSV file Column number | Next| *alias: Indicates the current variable reads the column data, note that the first column is 0

Clicking the Generate button generates a function such as ${__csvread (D:\jmeter\User parameter.txt,0)}, which indicates that the data is read from the first column in the D:\jmeter\User parameter.txt file. And so on

3. In the JMeter recorded script, locate the login that requires the parameter birch Username, password, the user name, the value of the password is parameterized, where the value of the user name is replaced by ${__csvread (D:\jmeter\User Parameter.txt, 0}, the value of the password is replaced with ${__csvread (D:\jmeter\User parameter.txt,1)}, the current script is saved, and the parameterization is complete (note: If you want to modify the parameter values to read, You can modify the numbers directly in the TXT list without having to re-modify them in the Csvread function generation)

4.Jmeter execution, if there are multiple threads, sequentially reads the number of the first row, if the thread group is more than the number of rows in the file, the loop reads.

__csvread use of common functions of JMeter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.