Jmeter interface automated testing - Jmeter download installation and getting started

Introduction to jmeter

Apache JMeter is a Java-based stress testing tool developed by the Apache organization. Used for stress testing software, it was originally designed for web application testing, but later expanded to other testing areas.

download

Download URL: Apache JMeter - Download Apache JMeter

Install

  1. Since Jmeter is a Java-based program, we must first install the Java environment if we want to use Jmeter. You can install JDK by yourself (currently the latest Jmeter5.1.1 requires Java8+, so it is recommended to install 1.8 or above)
  2. Unzip and download the zip, enter the directory apache-jmeter-5.1.1\bin, double-click ApacheJMeter.jar to open jmeter.

Use Jmeter to initiate an HTTP request

Request is in Json format

  1. Create a test plan: right click on the test plan -> Add -> Thread (User) -> Thread Group

  2. Right-click Thread Group -> Add -> Sampler -> HTTP Request

  3. Enter interface information: We used the packet capture tool to capture the interface of the blog garden to obtain the dynamics of the whole site. Taking this as an example, the interface is as follows

获取最新10条博客文章

Url: https://home.cnblogs.com/ajax/feed/recent

HTTP Method: Post

Request:
{
    "feedListType":5,
    "appId":"",
    "pageIndex":1,
    "groupId":""
}

 Entry Information


4. Add an HTTP information header manager: store the Request Headers here, because the default request data type of jmeter is form, so the request data in json format needs to be set in the HTTP information header manager

Content-Type: application/json; charset=UTF-8

  


  5. Finally, add a view result tree to view the response data of the request

 6. Run the HTTP request, we can see that the returned data is the latest developments in the blog garden

Request is in Form format

I searched around in the blog garden and didn’t find a request in the form format. I had to go to other sites to find it. Let’s take the following interface as an example.

Url: https://data.cma.cn/weatherGis/web/weather/weatherFcst/getCurrentCondition

HTTP Method: Post

Request:
staId: 54511

 1. The steps are basically the same as those in json format, the point that needs to be modified is the position of Requset Data
  

 2. Because the data is requested in form format, the Content-Type in the HTTP header manager should be set to

Content-Type: application/x-www-form-urlencoded; charset=UTF-8

 3. After the setting is complete, run the HTTP request and view the result tree to see the response data of the request.
  

Finally: In order to give back to the die-hard fans, I have compiled a complete software testing video learning tutorial for you. If you need it, you can get it for free【保证100%免费】

Software Testing Interview Documentation

We must study to find a high-paying job. The following interview questions are the latest interview materials from first-tier Internet companies such as Ali, Tencent, and Byte, and some Byte bosses have given authoritative answers. Finish this set The interview materials believe that everyone can find a satisfactory job.

Guess you like

Origin blog.csdn.net/IT_LanTian/article/details/131597297