Introduction to Python interface automated testing framework

I previously built a set of jmeter + jenkins + git + ant interface automated testing framework in the project. It has been running in the project for more than half a year, and the effect is not bad.

Recently, I have developed an interface automation testing framework of requests + unittest + ddt +pymysql + BeautifulReport. The test cases are in the yaml file.

Supports data-driven, database-connected queries. At present, the framework is not particularly perfect and needs to be optimized step by step in subsequent use. Currently, Jenkins has not been used for integration. In the future, it will be combined with Jenkins to create continuous integration.

Environment configuration

1、requests
2、ddt
3、pymysql
4、BeautifulReport

Precautions

You need to put the BeautifulReport folder under the python lib file site-packages

 

Implemented functions

1. Data-driven

2. Interface dependency

3. Connect to database query

4. Automatically generate test reports

5. Automatically send test emails

Module introduction

1. Common mainly contains public methods, such as operating database, reading configuration files, writing tokens, sending emails, etc.

2. conf mainly places configuration files, test environment addresses, database addresses, etc. in the configuration files.

 

3. TestCase contains the test script for each interface. The script starts with test.

4. testReport puts the test report

5. The yaml contains test cases for each interface.

6. run.py is the test case execution entry

 

testing report

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/hlsxjh/article/details/132721977