Charles Grab Bag Tool share

Source: Internet
Author: User

Today, to the large group of QA to do a share, mainly for mobile testing, introduced my usual in the test work used in the function, we are active response, on-site environment, on-site operation, on-site questions answered, finally, we all successfully use up, feel a sense of accomplishment. Here's what I'm sharing today:

I. Brief introduction of Charles

Second, installation and configuration

Third, the function

Iv. Q&a

I. Brief introduction of Charles

1.Charles is an HTTP proxy server, an HTTP monitor, and a reverse proxy server.

PS: The reverse proxy method refers to the proxy server to accept the connection request on the Internet, then forwards the request to the server on the internal network, and returns the results from the server to the client requesting the connection on the Internet, Reverse At this point the proxy server appears as a reverse proxy server externally. What I understand is that the phone sets the proxy connection to Charles, when Charles appears as a reverse proxy server.

2. It allows a developer to view all HTTP traffic connected to the Internet.

3.Charles is a simple debug tool based on HTTP protocol transmission, which plays an important role in development and testing work.

Second, installation and configuration

Charles Installation:

1.: Official website http://www.charlesproxy.com download

2. hack: Charles is a charging software that needs to be cracked. The solution is to download Charles.jar to replace the original jar package.

3.charles.jar:http://pan.baidu.com/s/1i3qt24h (I'm under the Charles version for 3.11.2)

Environment configuration:

1.Charles Port Settings
Proxy->proxy Setting, set the port number to 8888

2. Install SSL root certificate, view/Modify HTTPS interface
Install Certificate: http://www.charlesproxy.com/ssl.zip, after decompression, import mobile device.

Method reference: Toolbar help-"SSL proxying-" Install Charles Root Certificate on Mobile Device or ...

Follow the prompts to download the certificate:


3.SSL proxy settings: Proxy→ssl proxying settings→ Check the Enable SSL proxying→add→ add the domain name and port number you want to crawl to capture the Apollo app data as an example

4.ios&android Agent Environment Configuration
Connect WiFi, click Set HTTP proxy, select Manual;
Server fills in the IP address of Charles's local machine, port number 8888

Third, the function

1. Capturing Network Requests

Capture record control: Filtering network requests Typically, we need to filter the network requests and only monitor requests sent to the specified directory server.

"Proxy", "Recording Settings", then the Include column select Add a project, fill in the Protocol to be monitored, host address, port number, so that you can only intercept the target site's packets. If you intercept the Apollo app data:

Tick the Proxy→start recording to open the fetch record and see the Web request you've filtered in the Charles interface, as an example of the Apollo app:

Charles provides 2 views of the package, named "Structure" and "Sequence", respectively.
The structure view classifies network requests by the domain name that is accessed.
The sequence view sorts network requests by the time they are accessed.
You can switch back and forth between the two views according to your specific needs.
For a specific network request, you can view its detailed request content and response content. If the response is in JSON format, Charles can automatically format the JSON content for easy viewing.

2. Breakpoints

By using the breakpoint function to tamper with the requested data or the returned data, to achieve the simulated effect, the Apollo app has been tested as an example:

We can select "breakpoints" to the right of the interface so that the interface is added to the breakpoint state.

To further modify the properties of the breakpoint, you can add delete or modify in the menu bar "Proxy" –> "Breakpoints Settings", and you can choose whether the breakpoint is in request or response, or both.

Refresh the app interface and jump to the breakpoint template, you can modify the request or response in the corresponding state, then click the button "Execute" below.

Click the Edit response interface, choose JSON format, clear format, easy to modify, directly on the above data modification, change to the data you want to test, and then click the Execute button.

Refresh the app interface again, and then the app returns the newly changed data, testing the client for correct display based on the returned data.

3. Powerful maping

A.map Local
You can proxy a remote file to a local file for debugging. Here's how to use it:
Tools→map local→ tick the Enable map local→add→ to fill in the protocol, host address, port number where local files need to be mapped

Local files can be self-made test data, or the data returned by the interface can be saved to local and then modified, just first to save the interface return data to Local: Click on an interface response, right click on save Response.

B.map Remote: Analog domain hijacking
Implementation method: Map the requested domain name to another domain name via map remote
The function of map remote is the same as the principle of map local, which is the substitution request, except that the map local replacement request is a native file, and the request for map remote replacement is a line request.
How to use: Tools→map remote→ tick enable Map remote→add→ fill in the protocol, host address, port number for which you want to replace the request

: The splash interface is mapped to the entry interface, and the splash interface accesses the data of the entry interface.

4. Speed Simulation

Charles can simulate different networks, such as 2G,3G, and can also customize the speed of the network to simulate slow speeds.
Here's how to use it:
Open Speed Simulation, main menu Proxy--throttle Settings
Configuration: Open the Throttle Settings page, you can select some of the built-in bandwidth settings, or you can customize the settings to simulate the speed you need by setting the upstream and downstream bandwidth and round-trip delay.

5. Sending requests repeatedly

Repeat
This feature is especially useful for testing classmates, and can verify the robustness of the interface.
For the value of the front end is no need to refresh the page, only need to repeat request, such as verifying the success of the agent, after the request to modify the execution and so on.
How to use:
After you select the request, right-click Repeat to send the request again.
Advanced repeat can customize the number of repetitions and repeat intervals, sending multiple requests repeatedly.

Iteration: Number of iterations
Concurrency: Number of concurrent

Iv. Q&a

Charles Grab Bag Tool share

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.