A simple understanding
The Apache JMeter™ Application is open Source Software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.
The official website is jmeter.apache.org/
Install l website: jmeter.apache.org/download_jm…
L Directly decompress after downloading, no installation is required (prerequisite, Java running VIRTUAL machine environment is required).
L To start JMeter, click the jmeter.bat file in the bin directory.
Documentation: jmeter.apache.org/usermanual/…
Plug-in installation
Access: jmeter-plugins.org/install/Ins…
Location after download:
- Put the JAR package in the Lib /ext directory of JMeter and restart JMeter
- Validation plug-ins are available
Check the plugin
Two, the introduction of preliminary functional test
Step 1 create a Thread Group
Step 2: Add request Type 【sampler】
【 View results tree】
1. Add a thread group
TestPlan–> Add –>Threads(Users) add Thread Group
Threads(Users) :
setUp Thread Group
tearDown Thread Group
The setUp Thread Group is a common task Group. The setUp Thread Group is a common task Group. The tearDown Thread Group is used for cleaning.
2. Add Sampler (demo using HTTP Request)
Select Group, right-click > Add >Sampler, and select the protocol type to be tested. Take HTTP Request as an example
Display:
Description:
Protocol[HTTP]: No write is the default HTTP
Server Name or IP address: www.7dtest.com
Port Number: the default value is 80
Path:/ indicates the root directory
Paramters: There are two modes: key- >value and JSON. For details about how to test file upload, see Jmeter upload and download
3. Add the view result
Select TestPlan–> right-click –>add–>Listener–>View Results Tree,
Click on request:
Pop-up warning:
For whether you save after running
The results are as follows:
The View Results Tree component is very convenient to View the request data, response data, when there is a problem can be used to analyze the problem, in JMeter is used frequently
Write results to file/Read from file
L Filename: You can save the execution result to a file specified by Filename. Note: The execution result is saved in the bin directory of JMeter by default. If Errors is checked, only error messages are saved; If Success is checked, only successful execution information is saved; Save all information if not checked
L Browser: You can open previously saved test files and display test information in the result column below. If Errors is checked, only error messages are displayed; If Success is checked, only successful execution information is displayed. All information is displayed if not checked
1, Text: the default display mode, raw HTML Text
HTML: View the response data in a browser-like format
RegExp Tester: Supports re for checking and correlation
Such as: (. *?)
[1][0] : indicates the expression of the entire match
[1] : indicates the contents of a group
4. XPath Tester: Extract content using XPath
Reference grammar: [www.w3school.com.cn/xpath/index]…
l Use Tidy? : This option must be selected when the page to be processed is IN HTML format, and deselected when the page to be processed is in XML or XHTML format (for example, returned by RSS).
L Reference Name: the parameter storing the extracted value.
L XPath Query: An XPath expression used to extract values.
L Default Value: indicates the Default Value of the parameter
5. Use JSON PATH Tester as follows:
If: $. The extend. PageInfo pageSize
Refer to Java code as follows:
/ * *
@param json * @param path * @param filter * @return */ public static Object jsonPath(String json, String path, Filter... filter) { try { return filter.length == 0 ? JsonPath.parse(json).read(path, new Predicate[0]) : JsonPath.parse(json).read(path, new Predicate[]{filter[0]}); } catch (PathNotFoundException var4) { log.error(var4.getMessage()); return null; }}Copy the code
The above value treatment also starts with $.;
6, Scroll automatically: When many requests are made, the screen will be automatically rolled
If selected, the screen will automatically scroll
View Results Tree attempts to:
sampler result:
Description:
Thread Name: Thread Group 1-1: Thread Group 2 Indicates the id of the Thread Group. 1 indicates the id of the Thread in the Thread Group
Load Time: the execution time of the entire request
Connect Time: indicates the connection Time
Latency: indicates the Latency
Size in bytes: Headers size in bytes + Body size in bytes
Sent Bytes: indicates the number of bytes Sent
Request Request data
Response Data Response data
Summary reports provide simple instructions for use
Graph:
Running results:
Description:
Label: indicates the Label. If you select Include Group name in label? This option prefixes the name of the thread group (checkmarked when aggregated reports monitor multiple thread groups)
Samples: Number of Samples with the same name
Average: indicates the Average response time (milliseconds). The default value is the Average response time of a single request. When a Transaction Controller is used, the response time can also be measured by Transaction
Median: indicates the Median. So 50% of the samples don’t last longer than that
90% Line: 90% of samples do not exceed this time
95% Line: 95% of samples do not exceed this time
Min: indicates the minimum execution time for the same label samples
Maximum: indicates the Maximum execution time of the same label sample
Error % : indicates the Error percentage
Throughput: Throughput, generally considered as TPS. Throughput is measured in requests per second/minute/hour. When TPS is very low, JMeter defaults to counting in minutes.
Received KB/Sec: Received throughput in kilobytes per second
Sent KB/Sec: Throughput in kilobytes Sent per second
Save Table Data: Saves the Data to a CSV file
Include group name in label? : prefixes the name of the thread group
Open a file as follows:
Brief description:
You can select the configuration based on the actual situation