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 CSV parameterization / checkpoint / assertion

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

You can use the CSV Data set config method when the value of the parameter is irregular and the quantity is not too large.

Case study:

Apply Sogou automatic search keywords: software development testing, web functional automation testing, performance automation testing, Selenium and Jmeter

Requirement: use Jmeter's CSV Data set config to complete

Specific steps:

1. Create a csv file with a value set of parameters, each parameter in a column, and start writing parameter values on the first line, not parameter names.

For example, add the following to D:\ test.txt

two。 Open Jmeter and open the search.jmx script that was previously recorded using Badboy

3. Then add a "configuration component"-> "CSV Data Set Config" to the test plan or thread group, as shown in the figure

4. In the same way, add objects that need to be tested: for example

Add view result trees, assertion results, aggregate reports, response assertions, assertion response time, and Size Assertion that need to be tested.

As a result, you get:

5. Click CSV Data set config

Fill in the full path of the csv file in step 2.1 in Filename (D:\ test.txt)

Enter gbk in File encoding (avoid garbled code)

Fill in the variable name user in Virable Names (if there are multiple variables in the csv file, separate them with commas)

As shown in the figure:

6. Click https://www.sogou.com/web on the left, and then, at the user variable, enter ${user} parameterization

7. Response assertion settings

8. The assertion duration setting is set to 900ms here, which is relatively long. You can set a reasonable time according to the actual needs.

9. Run and get the result:

Result analysis:

Green means: pass

In the response data, the words "software development test" can be found, indicating that the search has been successful.

Since it is parameterized, then all should be searched, as shown in the figure:

In the response data, the words "web function Automation Test" can be found, indicating that the search has been successful.

By the same token, other keywords were searched successfully.

10. Looking back, the result of the assertion is as follows:

The time used to run runs successfully within the set time.

This is the operation of CSV Data set config parameterization and assertion response.

Specific in the actual process, will encounter a variety of problems, according to the actual situation, debugging, such as

At the assertion duration, set it to 300ms, and after running, the result is as follows:

It is obvious that the setting time is unreasonable when such a mistake occurs.

Similarly, you can see the exception at the result of the assertion, as shown in the figure:

If other settings are unreasonable, an error will be reported. Debug it step by step until the result is satisfactory.

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

Servers

Wechat

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

12
Report