The jmeter interface automation test that major manufacturers are doing is the pinnacle of JMETER to achieve interface automation testing

content

1. JMETER environment construction

Second, the localization of JMETER

Three, JMETER interface request

Fourth, the parameterization of JMETER

Five, JMETER's JSON parameters

Six, JMETER assertion added


1. JMETER environment construction

    Reference: https://www.cnblogs.com/qmfsun/p/4902534.html

Second, the localization of JMETER

    Temporary localization method: open jmeter, options-->choose language-->choose language

    You can choose Simplified Chinese or Traditional Chinese according to your needs, as shown in the figure:

However, this method is temporary localization. After exiting the software, opening the interface again is still in English style. If you need permanent Chineseization, you can modify the jmeter configuration file jmeter.properties:

Enter the installation directory of jmeter, find the configuration file and open it with npp, add a line under # language=en: language=zh_CN, you can achieve permanent Chineseization.

Path to configuration file: ../jmeter/apache-jmeter-5.0/bin/jmeter.properties

Tips for finding characters in npp: Press Ctrl+f to call up the search popup in the current file, enter the characters to be searched, and search backwards until the position to be searched:

Three, JMETER interface request

3.1. Open Jmeter: After downloading Jmeter, double-click the jmeter.bat file in the bin directory:

3.2. Add thread group: Right-click on "Test Plan"-->Add-->threads(Users)-->Thread Group, add test scene setting component, generally set to 1 "thread number" in interface test , and set the "cycle times" according to the number of test data.

3.3. Add "HTTP Header Manager", "HTTP Cookie Manager" and "User-Defined Variables"

3.4. Add HTTP request

3.5. Add information: including header manager information, custom variables and HTTP request information

header manager information

User-defined variable information

HTTP request information

3.6. Add the view result tree (listener) and execute the view result

Request result view

Fourth, the parameterization of JMETER

    Application scenario: save the parameter values ​​required by the interface in a csv or txt document, and the interface obtains the parameter values ​​in the document through the parameter name

    4.1. Add csv component

    4.2. Fill in the parameter name and parameter value in the csv file

    4.3. CSV data file settings

    4.4, HTTP request parameterization

    4.5. View test results

Five, JMETER's JSON parameters

    Application scenario: After the first interface response is completed, a parameter value in the response body of the first interface is obtained as the request parameter value in the request body of the second interface. The obtained process usually uses regular and json extraction. Here Talk about json extraction

    5.1. Add json extraction component from post processor

    5.2. Positioning parameter location (recommended to use chrome plugin "JSON-handle")

 5.3, json extractor adds extraction information

    5.4. Pass new parameters to the second interface

    5.5. Execute the second interface

    5.6. Verify that the positioned json location is correct

Six, JMETER assertion added

    6.1. Add "Response Assertion" and "Assertion Result"

    6.2. Add assertion information

    6.3. View assertion results

Assertion result information

Assertion result information in the result tree

 

Thanks to everyone who read my article carefully, watching the rise and attention of fans all the way, there is always a need for a gift exchange, although it is not a very valuable thing, if you can use it, you can take it directly:

① More than 2000 Python e-books (mainstream and classic books should be available)

② Python standard library information (the most complete Chinese version)

③ Project source code (forty or fifty interesting and classic training projects and source code)

④ Videos on basic introduction to Python, crawler, web development, and big data analysis (suitable for novice learning)


 ⑤ Python learning roadmap (say goodbye to inexperienced learning)

In my QQ technical exchange group (technical exchange and resource sharing, advertisements come in to interrupt you)

You can take it away by yourself. The free information in the group number 913569736 (note "csdn000") is the essence of the author's more than ten years of testing career. There are also peer gods to exchange technology together.

The learning materials can be found by our Miss Beibei [mashan-qq] remarks [csdn000] for free

【Must note】Otherwise it will not pass
 

Guess you like

Origin blog.csdn.net/csdnchengxi/article/details/122870221