Web Interface Test Practice Review

Source: Internet
Author: User
Tags md5 digest number sign

In the previous period of time, the system learned the test expert's "web interface development and automation test-based on the Python language", and also imitated the completion of the project, harvest quite abundant. Because there is no error log output on the server, postman and fiddler play a great role in locating errors and debugging the interface. In the past, learning these two tools alone, and did not feel their strong, sure enough, in the project in combat learning more efficient!

On the basis of existing projects, all interfaces are optimized, adding 10 interfaces: The interface of the HTTP Basic Authentication version and the MD5 Digest certified version are implemented. In addition, the ability to automatically send test report messages is implemented.

Interface testing also has a number of common scenarios, such as obtaining a cookie automatic login, handling HTTPS interface, using mock simulation, etc., this project is not involved in the future perfect.

Review the following:

GitHub Address: Https://github.com/yulifromchina/InterfaceTest

First, the project results show

Ii. technology used in the project

Development platform: Windows Ten x64 + pycharm + python3.6 + mysql 5.7.21

Registration system: Django 2.0.1 + django-bootstrap3-9.1.0

Test Frame: Requests 2.18.4

Iii. specific introduction of the project 1, Conference registration system

The functions of the Conference registration system include: Login, Conference management, guest management, sign-in function

The approximate logic is that when a user logs on, it initiates a POST request to the server, validates through the Django Auth module, and stores the user information in the server session. In the case of login, users can browse the conference, guest list, and sign in after entering the Release Management page. If you are not logged in, you will not be able to access these pages (implemented via Django's login_required adorner). The user enters the mobile phone number sign in, backstage will the mobile phone number and the press conference as the joint primary key to the background database verification, and carries on the check-in, the press conference whether has ended and so on judgment, finally returns the registration result.

All of the above logic is responded to by different routes and callback functions, and the callback function takes the data out of the database and returns it to the browser when rendered by the template.

The interfaces provided are as follows:

2. Testing Framework

The structure of the test framework is as follows:

The interface is requested and the requests library is used;

Case of the organization, using the UnitTest test framework;

Test report, using Htmltestrunner generation;

Test data, using the MySQL database storage;

e-mail sent, using smtplib and email library.

Each interface consists of several use cases, each of which is responsible for the test of a py file:

Iv. Summary of the project

Interface testing There are a number of professional platform services, such as the three-swordsman interface test Platform, is the use of the site platform or self-development test framework, or two times development, depending on the specific situation of the project, there is no absolute good or bad. Through the actual completion of the interface, and the interface to write, deepen the understanding, I believe that better use of tools. Use Django to develop projects quickly and with a clear structure.

There is a bug in the project that is not resolved. In run_test.py, currently cannot raw_*.py, http_*.py,md5_*.py three versions of 15 use cases run together, can only be divided into three batches run. Because of these three batches of interfaces, the same batch of data is inserted into the database, so running together can result in data contamination. An attempt was made to empty the database and reinsert the data between three runs, but the insert operation fails. There is no reason to locate. If there is a similar situation with Daniel, hope to advise! Thanks a lot!

Web Interface Test Practice Review

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.