Based on Fiddler to modify the interface to return data for testing

Time:2021-2-15

Method introduction and comparison

In the process of testing, some requirements are like this. It requires you to modify the data returned by the interface, so as to check whether it is displayed correctly in the client mobile app. This is also a kind of interface fault tolerance test, which belongs to one of the app performance (special) tests.

Through fiddler, we can modify the returned results in several ways:

First, in the display area of the black command line at the bottom of fiddler, you can intercept by pressing enter in the form of BPU URL, and access the specified interface through the mobile app. After intercepting, you can select the response file to intercept;

Second, add rule in autorespnder, and then set the content of response in rule editor;

Third: select after responses in automatic breakpoints in rules settings to intercept.

First, you can’t create a custom response, you can only specify the response in the form of a file. The third way is to intercept all requests, which is too rough and extensive. So in the actual test interception request, the most flexible and the most powerful is the second one.

Detailed steps

The following is the whole process of the second interception method

1. Grab the packet, find the request to be intercepted, and then add rule in autoresponder

2. Select “create new response…” in the second column of rule editor

3. Click Save, a window will pop up, select raw column in the pop-up window, copy and paste the raw column content corresponding to the request captured, then modify the part to be modified, and then click “save” to save:

After that, you can automatically intercept the request and modify the return body.

4. If you want to frequently modify some contents of the replacement return body, you can right-click the corresponding request to be intercepted in autoresponder and edit the return body with “Edit response”:

If you want to be more convenient, you can right-click the corresponding request to be intercepted in autoresponder, “generate file” to save the response body to the local TXT file, and then open the txt file to modify and save it.

However, note that if the response content is saved in the form of a file, there may be client processing errors caused by coding problems. The most recommended way is “create new response…”

One sentence overview

The above four steps are the whole strategy of intercepting requests through fiddler.

The above is the whole content of this article, I hope to help you learn, and I hope you can support developer more.