I. introduction of JMeter
Jmeter is an open source stress testing tool based on Java developed by Apache , which is small in size, full in function and easy to use. When you run jmeter , you must install the jdk. Jmeter is a cross-platform software that can be used in Windows,linux,macos . Jmeter can perform interface tests or perform performance tests.
Two. Jmeter interface Script
1. Add a thread group
2. add an HTTP request
3. Write interface URL, path, request method, parameter in http request
4. Add View results Tree
5. call the interface to see the return value
Three. use of jmeter
1.jmeter Normal request an interface
2.jmeter setting JSON string entry parameter
31.jmeter Add header
The first step
Step Two
4.jmeter adding cookies
The first step
Step Two
5.jmeter Adding Files
Four parameterization of Jmeter settings
three ways to set up 1.jmeter parameterization
1. User-defined variables
this is to facilitate the management of parameters, there can be only one value, such as the IP address does not change frequently
Add a user-defined variable to the thread group, then write the key and value , andkey is the name of the parameter, which is the value you take in the script. Value is the exact number. When taking the parameterized value, use ${name} to get the value, name is the name of the variable you are taking.
The first step
Step Two
Step Three
2. Function Generator
The function generator can generate data with reference to certain rules, such as generating some random numbers
Function generators are commonly used in three of cases
A. random number _ranmdom, you can take a random number within a range you specify
The first step
Step two : Find--random, generate string
Step three: Copying add places that need to be parameterized
B. set the time
C. using function generators to take unique values
3. read from the file
File reading is to write some data in advance, and then read from the file, so that, for example, login interface, account and password are our pre-registered good
The first step :
Step Two
The third step: Create a file locally, such as create a txt file, get its path
Fourth Step:
Five Jmeter Assertion
What is an assertion? It is used to check whether the returned results are correct.
To verify that the result is correct, if it is correct, it means that the return of the request is correct, and if not, the result of the request and the inconsistency we expect, so that we can check the result of the assertion and test whether it is passed.
The first step
The second step is to add what you want to test
Six. JMeter Association
The association is to get the return value, then save it, use it for another request, or do some other processing.
The first step
Step Two
The use and introduction of interface test Tool-jmeter