Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

background

When doing interface testing, you need to test some extreme scenarios, because the interface test will design some exception or boundary value scenarios, and you need to pay attention to the front and back end interaction, and see how the front end responds. So there are many tools to achieve this scenario, the implementation idea is through packet interception or proxy, here introduces Charles to packet interception tamper with interface data implementation.

  1. Firstly, install Charles packet capture tool on PC side, configure listening port, set proxy on mobile side, install SSL certificate, easy to capture HTTPS request interface;

  1. First request an interface or use Charles to enter the interface, then right-click the interface and select BreakPoints and open the toolbar for BreakPoints

  1. This time start step by step operation, through the front end request the interface, if the interface test can select the toolbar pen tool to create interface test:

  1. Breakpoints are used to modify the request parameters step by step after interception:

  2. Click Execute to modify the interface response message:

  1. After the modification is complete, execute performs the next step to modify the data of the entire interface, including request parameters and response packets, as required.

 

  1. Feel so easy? Of course, the time limit for this process is limited. Of course, Charles currently provides three methods: Map, Rewrite and Breakpoints. Breakpoints are briefly introduced here.