Jmeter use csv file read test data

Jmeter use csv file read test data

Recently a colleague encountered problems to build a batch of test data in the testing process, these data are often the same document, but with different contents of the documents, if it is more time-consuming manual creation. Then we use jmeter the csv file to read the test data is the perfect solution to this problem.

Today, we use the open API blog to park for example, the following interface information

获取新闻内容

Url: http://wcf.open.cnblogs.com/news/item/{CONTENTID}

HTTP Method: GET

First, we create a CSV file, and then our batch testing data CONTENTID (News Id) into the past:

Then we add the test plan for the arrangement of elements - "CSV data file settings"
steps: Open jmeter -> Add Thread Group -> Add Original Configuration -> CSV data file settings

Adding an HTTP request, we will write to test the interface into
steps: Right Thread Group -> Add -> Sampler -> HTTP Request

Everything is ready in the following figure:

We set the number of threads and number of cycles start (here I set up a thread loop 15 times):

Then view the results tree:

CONTENTID will find that the data is already CSV data file, and the corresponding response data is the content Id.

Finally, we return to the beginning of the problem, make a lot of different aspects of the same documents. We use the CSV file to store different content, use jmeter cycle call interface to create data, so do not go manually create documents, and save time and effort.


CSV file settings Parameters:
parameter Explanation
file name The path to your CSV data file
file encoding May be, for example, UTF-8. So will jmeter to read UTF-8 file
Variable name To a comma-separated list of names that match the CSV file columns.
Ignore the first line If the first line is a column name instead of test data, select True to ignore the column name
Separator Defaults to ',' may also be set to other values ​​(recommended default)
Whether to allow the quotation marks The default is False, if the test data set with the marks Ture
Encounters end of file cycle again The default is True, meaning finished reading the last line of the first row in back
Stop the thread encounters end of file After reading the last line stop thread
Thread sharing mode Define how to assign a value between concurrent threads

Guess you like

Origin www.cnblogs.com/ezrealli/p/11260938.html