Write directory title here
- 1. Summary of knowledge points
- 2. Basic use of Charles
- Three, charles packet capture analysis
- Fourth, Charles uses
- 5. Web packet capture practice
- 6. App packet capture practice
- 7. Mock test
-
- 1. What is mock test
- 2. The value and scenarios of mock testing
- 3. Use Charles to complete the Mock test
- 4. Rewrite practice
- 5. Map Local practice
-
- 1. Select the interface to be mocked, right mouse button, save Response, modify the response data
- 2. Right-click the mouse, select Map Local, enter the setting interface, automatically fill in the data related to the interface url, and select the local data of the target
- 3. Tools——Map Local, double-click the rule to enter the modification interface, check the enable function to take effect
- 4. New responsive page
- 6. Map Remote practice
-
- 1. Select the interface to be mocked, right mouse button, and select Map Remote;
- 2. Enter the setting interface, automatically fill in the relevant data of the interface url, select the local data of the target, and fill in the url information of the server to be forwarded
- 3. Tools——Map Local, double-click the rule to enter the modification interface, check the enable function to take effect
- 4. New responsive page
1. Summary of knowledge points
How to locate whether the bug is generated by the front end or the back end?
How to obtain interface information when there is no interface document?
1. Capabilities required for interface packet capture
Proxy function: HTTP/HTTPs, SOCKS5.
Request simulation tool: assembly request, replay request, repeat request.
Network environment simulation: speed limit, timeout, return exception.
Mock: request modification, response modification.
Fake: Replace the real environment with a test environment.
2. The principle of interface packet capture
2. Basic use of Charles
Tool preparation
Charles installation
Basic computer configuration and certificate configuration completed
Mumu emulator packet capture configuration completed
Reference post: https://ceshiren.com/t/topic/21956
Three, charles packet capture analysis
Grab interface data
Overview: The general situation of the interface
Content: Request information and response information
The first half: request, request header information, request parameters, cookie
The second half: response, response header information, response body (different formats)
Summary: Response time
Chart: Resource status display in icon form
Notes: Write some records
Fourth, Charles uses
1. Filtering: Filter, Focus
2. Repeat: Repeat, Repeat Advanced
3. Modification request: Compose
4、弱网:Throttle Settings
5. Web packet capture practice
Grab snowball search interface data
When there are multiple interfaces, you can use ctrl+f to find a specific interface, as shown in the figure below
View the interface response status code and the protocol version used
View request parameters and response content in json format
Edit the request parameters, replace the search content with your own name, resend the request, and view the response content
Interface to quickly filter snowball domain names
6. App packet capture practice
Grab snowball search interface data
View request parameters and response content in json format
Set resend 10 times, the number of concurrency is 2, and the delay time is 500ms
Perform a weak network test, select the weak network mode as 256 kbps
7. Mock test
1. What is mock test
In test activities, for some more complex data/scenes that are not easy to construct or obtain, a virtual object (Mock object) is used to create a test method for testing.
2. The value and scenarios of mock testing
Value:
No reliance on third-party data.
Save work.
Save joint debugging.
Scenario:
front-end and back-end data interaction.
Third-party system data interaction.
Decoupling of hardware devices.
Boundary value testing.
3. Use Charles to complete the Mock test
Rewrite: Dynamically modify the data in the request and response; suitable for global modification or simple modification of content
Map Local: Complex modification of the response body Map
Remote: Modify the address of the server to be accessed; in App testing, you can directly modify without repackaging test environment
Use the interface of Snowball Quotes Preferences – stock price reminder list.
Rewrite:
Change the first stock name in the list to your own name.
Change the ticker symbol of the second stock in the list to hogwarts.
4. Rewrite practice
Use the snowball to set the interface of the hot stock list.
Rewrite:
Change the name of the first hot stock in the list to your own name.
Change the name of the second hot stock in the list to another name.
Match all requests ending with .json, as shown in the figure below
5. Map Local practice
Use Snowball to set up the interface of hot news list.
Map Local:
Change the name of the first hot stock in the list to your own name.
Change the name of the second hot stock in the list to another name.
1. Select the interface to be mocked, right mouse button, save Response, modify the response data
2. Right-click the mouse, select Map Local, enter the setting interface, automatically fill in the data related to the interface url, and select the local data of the target
3. Tools——Map Local, double-click the rule to enter the modification interface, check the enable function to take effect
4. New responsive page
6. Map Remote practice
Use Baidu search interface.
Map Remote:
Redirect the interface to the Sogou interface.
Baidu will display a warning pop-up window, pay attention to the interface data captured in Charles