- Development ideas
1. To develop an application-side interface automation case, you first need to use Fiddler to capture the package;
2, the current app-sides are all https protocol, so you need to open Fiddler’s https protocol
3. After the capture is completed, use jmeter to simulate the request, the debugging is successful, and the case development is completed;
4. The operating system installed by the app captured this time is ios< br>5. The case developed this time is login and query case
First, use Fiddler to capture packets
1. First enter Tools> Options, set HTTPS request capture, check the Capture HTTPS CONNECTs option under HTTPS
2. Set the proxy port. The default is 8888. Remember to check the Allow remote computers to connect option. After the setting is complete, click the OK button.
3. The mobile phone has been connected to wifi (the connected wifi network needs to be the same as that of the computer ), set the wifi proxy, click to manually enter the computer ip, the port and fiddler are consistent, as shown below
4. Enter the ip: port in the mobile browser, my address is 192.168.0.108:8888 and you will enter the fiddler certificate installation page, click Fiddler Root installation
5. At this point, go to System Settings>General>About This Machine>Certificate Trust Setting to enable the trust of FiddlerRoot certificate
6. After entering Settings>General>Description File and Device Management, check whether the Fiddler Root configuration file has been verified. If it is verified, the certificate installation is successful< br>
7. At this time, you can open the app, enter the user and password to log in, At this point, you can see that fiddler successfully grabbed the login request.
Second, use Jmeter development case
1. Open jmeter, add thread group
2. Add HTTP header manager in the configuration component, HTTP request default value
< img alt="Use Jmeter to develop app-side interface automation case actual combat" s rc="/wp-content/uploads/images/architecture/auto-test/1626814347000.png" >
3. Add HTTP request in the thread group
4. Add the observation result tree in the listener
5. According to the request parameters (user, password) of the packet capture, the login can be determined The fiddler request is as follows:
6 .Add the header types Content-Type and Authorization to the HTTP header manager of Jmeter. The Authorization option is used to verify the login information. You only need to fill in the token obtained in the login request. Why do you need to declare Authorization in the header? , You can see that the interface calls the header in the request in the query packet capture, so you need to declare
7. Add the protocol, server name, port number, and encoding type: UTF-8 to the default value of Jmeter’s HTTP Request, so you don’t need to declare every interface request, you can leave it blank
8. Capture packets based on HTTP requests How to fill in the login request: POST, interface address, request parameters
9. Because you need to get the Token in the login response result, you need to add a post processor, JSON Extractor, input the defined variable name, variable path, Match defaults to 0
10. You can add a Debug Sampler, the sample can display all variables, debug once, the result is as follows , As can be seen from the figure, the token is successfully obtained:
11. At this time, you can develop the next interface, you only need to fill in the interface The request method, path, and parameters are as follows:
12. Add the response assertion of the query interface to determine whether the query result is correct. For this interface, select errorCode “:0,”, as shown below.
13. Debug once, check the response result of the query interface and the display of the fiddler capture packet. Case development is completed, other interface case development, just follow the query interface
If it helps you, remember to like it