10. Export python scripts for data-driven interface testing

Postman comes with its own script export function. For code beginners, it can be a good way to learn code-level interface testing.

 

Step 1: Enter the interface address and click send

 

Step 2: Click code to export the script file as a python script

 

 

The third step: install python3 and use pip to install the requests library, not much introduction here

 

Step 4: Run the test script

Step 5: Supplement

We see that the above script has no assertions, so it cannot be called a test case, but a test script. It is recommended to learn the unittest unit testing framework of python. After learning, you can use the script to write test cases smoothly.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325295951&siteId=291194637