How does the Charles tool do breakpoint testing?

insert image description here

In the process of testing work, we often set a breakpoint on a certain line or link of the program, and modify the parameters, requests or responses at the breakpoint during the process of the program request to locate the problem. This is the so-called breakpoint. point test. This type of breakpoint testing is mainly used for interface testing.

Breakpoint test can easily locate the front-end or back-end problem by viewing the data returned by the interface. At the same time, it is convenient to construct test data by changing the request and response data.

In short, breakpoint testing can locate problems faster by modifying interface data. This is a common method of testing.

► How does the Charles  tool do breakpoint testing

The Charles  packet capture tool can easily implement breakpoint testing.

The specific implementation steps are as follows:

The first step: start the breakpoint

Click the breakpoint button in the tool menu bar, as shown in the figure below, to start the breakpoint function. insert image description here
Or in proxy -> breakpoint setting --> start the breakpoint setting:insert image description here

Step 2: Add the target interface to the breakpoint configuration

1. Start packet capture first, and capture the corresponding request;

insert image description here

2. Select the right button of the request and select "Breakpoints" to add this interface to the configuration of the breakpoint:insert image description here

In this way, the configuration of this interface will be added in the breakpoint settings of the proxy; if you access this interface again next time, the point will be triggered.

insert image description here 

Note here : After a breakpoint is added to each interface, the requests message and response message will trigger the breakpoint by default.

Step 3: Request a breakpoint

When the interface request is sent again in the browser, the breakpoint will be triggered, and a new window will pop up in the Charles tool, which is the page of the breakpoint. This is the breakpoint triggered by the request message, and the request message is also displayed:insert image description here

4. Click Edit requests to modify the request message, then click "Execute" to execute the request, and check the results displayed on the page:insert image description here 

After editing the request message, click "Execute", and the edited request message will be sent to the backend; for example:

Change the value of the page parameter to "2". After clicking Execute, you can see the corresponding effect on the page, which is displayed as the data of the second page:insert image description here

Step 4: Respond to breakpoints

If the response message is also configured in the breakpoint settings, the response message will also trigger the breakpoint, and the breakpoint page will display the response information:insert image description here

Then you can edit the response message on the "Edit Response" page, such as deleting all the content of the response message, and then click "Execute":

insert image description here

You can see the corresponding result display synchronously on the page, and there is no data display.insert image description here

Guess you like

Origin blog.csdn.net/nhb687095/article/details/131554545