Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

JMeter Interface Test _ Parameterization

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Corresponding qq group number: 616961231

Brief introduction:

Environment: Mac OS

Home directory similar to windows self-built directory such as: D:/test/id.txt

The previous article introduced the basic use of jmeter, slightly mentioned how to do parameterization, this article further explained the parameterization.

Jmeter probably has the following parameterization methods:

The use of parameterized scene 1User Parameters is suitable for using 2CSV Data Set Config when the range of parameter values is very small. This method is more flexible. 3User Defined Variables is generally used for parameter settings in Test Plan that do not need to iterate with the request. For example, functions in Host and Port Number4Function Helper can be used as supplements to other parameterized methods, such as ${_ Random (,)} generated by random numbers.

Parameterized meaning:

Parameterization can use different data for a variable. For example, when multiple users place an order to purchase goods, the API for calling and issuing an order is the same, but the user's id is different. The test interface using different users can more realistically simulate user scenarios, and can also be used in multi-user concurrent scenarios.

One definition, multiple uses, one modification, multiple modifications.

Today I'm going to talk about the slightly more complex CSV parameterization.

Continue yesterday's example, right-click thread group-> add-> configure components-> csv Data Set Config

The native home directory creates the file id.csv file, and sets the file directory in csv, as shown in the figure

The id.csv file is as follows:

In id.csv, we set up two different id, and the caller is in the http request

Then set up the thread group and execute it twice (we only set up two id)

Here, the setup has been completed, and then execute the thread group, and you will see 2 different results

The two results of id are consistent with our two id of id.csv, and the parameterized values are assigned normally to meet the test expectations.

Multiple file formats can be supported in Csv data set config. Let's use a txt example to show how to create an id.txt file in the directory home directory, as follows:

In modify Csv data set config, change the file name to id.txt

Remember to clear the last record before execution. We also gave 2 id in id.txt, which will be executed twice.

Both methods are very easy to use and achieve the desired results. I do not know if you have learned, if there is not clear welcome to leave a message to me. If the article is helpful to you, please follow my official account and share and retweet, so that more friends can grow together.

Today's recommended reading articles are recommended

Why do interface testing?

JMeter database operation

Jmeter Interface Test-regular expression

JMeter returns garbled code in Chinese

Jmeter interface testing-parameterization

JMeter Interface testing-Basics

Test-impression

Add Wechat to the consulting work

scan a QR code

Welcome self-recommendation and recommendation, need Wechat to push resume!

Please poke the QR code below to learn more.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report