[Interface Automated Testing] Teach you step by step to build an interface environment

To do interface testing, we have to build a local interface environment that can run. This time I chose a system that is easy to set up and suitable for learning - the student management system.

Python installation

This management system is written in Python code, so it requires a Python environment.

The installation is pretty mindless, just follow the installation package and method I provided.

Postman installation

Postman is an interface testing tool. It is also a brainless installation, just install it according to the installation package and method I provided.

Pycharm installation

Pycharm is a python language editing tool. +3 for brainless installation, let’s not talk about it~

 

Project deployment

01 After decompressing the project, open the project with Pycharm

02 Type commands in the command line window of Pycharm to install the modules that the project depends on.

pip3 install -r requirements.txt -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

03 Type the command in the Pycharm command line window to start the project

 

python run_server.py
 
tips:因避免2端口占用,我已修改项目的默认端口为8099,IP是本机127.0.0.1(可以在run_server.py中自行修改)

Because I have modified the default port in the py file, it may be inconsistent with the URL in the interface document to be discussed later, but it doesn’t hurt~

 If you run it, you will get the following error (caused by Django version incompatibility)

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x0000024D934BDD08>
Traceback (most recent call last):
……
File "C:\Python37\lib\site-packages\django\contrib\admin\widgets.py", line 152
    '%s=%s' % (k, v) for k, v in params.items(),
    ^
SyntaxError: Generator expression must be parenthesized

 

You need to jump to the error path, remove the comma, and then re-type the python run_server.py command to start the project.

04 Read the interface API document or interface list in the project and get the interface

05 Enter in the browser: IP:port/api/departments/If the data can be obtained, it proves that the service is started successfully.

 

Try it in Postman and get the same result, no problem.

Above, the environment is ready. If you encounter any problems, you can leave a comment below. Next time, we start interface testing.

Thank you to everyone who reads my article carefully. There is always a courtesy. Although it is not a very valuable thing, if you can use it, you can take it directly:

These materials should be the most comprehensive and complete preparation warehouse for [software testing] friends. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey. I hope it can also help you! Anyone in need Partners can click on the small card below to receive it

 

Guess you like

Origin blog.csdn.net/chengxuyuznguoke/article/details/132676283