This is the 17th day of my participation in the August Challenge

To undertakeOk,If a cross-site request fails, it needs to be handled. In tools, there is app.py on the web, find Application, and close the cross-site request in __init__ method.

xsrf_cookies=False
Copy the code

Once this problem is solved, the background can receive the data. Received data, now is the ID mode and other parameters, can be directly part of the conversion, but if you want to really get the ID of the data.

Method 1: When recording, directly store the data into redis.

Method 2: Call mitmProxy API to directly obtain the corresponding data by ID.

Method one: you need to write a separate file to save this file, and store a copy in Redis by yourself. The specific implementation can be searched on Baidu, and mitmProxy can be saved locally. Method two: you need to find API, and you can choose either way by yourself. All the apis are in the Application, if you need them, you can find them. You can find all the apis that the platform can use. If you don’t know how to get the API, you can look at the request on the front end, using Chrome’s F12 developer, and each selected interface request will be sent, and that API is the API to use. Note: The API request parameters are put into memory and cannot be kept permanently.

After getting these data, the background obtained these data, of course, here can not be directly into the library, need to clean the parameters. So let me give you some ideas.

1. Write to the frame.

2. Write directly to the platform.

The framework does not have a separate external interface, so you can use flask to open an interface for python. The interface takes the request and processes it. When you get the data of the interface you want to record, you need to optimize the URL parameters, request methods, and output parameters as necessary. Url can be directly corresponding to the path to the test environment and API. Request parameters can be used directly. Request methods can also be used directly. For output parameters, it is recommended that the necessary fields of output parameters be cut according to certain rules and used as assertions. Some parameters can be processed to contain or not contain assertions. Once you’ve done this, take the overall data directly to where your framework manages your case. If the case needs a number or a name you can give it a random one here, but you need to mark it with a case generated by recording.

Interface test platform writing ideas: directly use the existing platform to develop an interface to write. Interface wash data, you can refer to the above. When entering the database, the specific logic that needs to be matched can be executed by referring to the project of our company. It is best to mark the mark recorded here when entering the database, because the use cases may be modified and corrected later.

Once written, all written use cases can be played back or run to view.

So here’s the general idea. Specific problems need to be analyzed on a case-by-case basis. It’s just a little bit of a nudge.