design concept
Focusing on task scheduling , 80% of interface automation is written locally, and 20% is managed by the platform.
If you use pytest for interface automation, then I personally think that the best writing tool is PyCharm, which cannot be replaced by any low-code testing platform. Of course, if you don’t know how to code, or don’t use pytest, low-code test platforms, or yaml, or even excel to write automation use cases are acceptable. In the specific scenario of using pytest, to be platformized, the functions of the platform need to be carefully considered. Since it is best to use PyCharm to write use cases, the platform can only focus on use case orchestration and task scheduling, that is, creating tasks, associating use cases, running in batches, and timing, parallelism, notifications, etc.
pytestx is a pure task scheduling platform designed based on this concept.
platform architecture
Continuation of tep1.0.0
The tep1.0.0 version has been closed, and it has been continued in pytestx.
from pypi to git
The tep is uploaded to pypi, installed through the pip command, and the project scaffolding is created using the tep startproject command. The code structure is divided into project code and tep code. The transformed tep only has the project code, which is stored in:
https://gitee.com/dongfanger/tep-project.git
In other words, in this project, you can see the whole picture of the tep. The previous tep kernel code, such as automatic search for fixtures, built-in fixtures, environment variables, etc., have all been migrated to the project code, especially the file content of conftest.py. The dependent packages installed by pip install tep are also sorted into requirements.txt, just follow the instructions to install.
pytest-html replace allure
From heavy to light, simplification, pytest-html can meet the reporting needs of data + logs, and the interface of the latest V3.2.0 version is acceptable. It is true that allure is beautiful, but it is relatively troublesome to install Java, download Allure, configure environment variables, install pytest-allure, and add pytest hook. More importantly, to support the platform to view reports online and reduce storage usage, pytest-html is undoubtedly a better choice.
Download Scaffolding
You can download the code from git clone or from the page, just like spring.io:
fastapi to django
The previous sample code is the application started by calling fastapi, and pytestx replaces the interface of the sample code with Django's own mock interface.
continuation of teprunner
The basic code of pytestx comes from teprunner, which optimizes database design, code specification, and project structure.
task management
1. Synchronization project
Synchronizing the project is to update the Git warehouse address and branch configured by the project to the local sandbox, and the projects are completely isolated.
And put the use case into the library:
2. Task-associated use cases
Create a task and associate the task with a use case to form a new set of use cases.
3. Containerized operation
Currently it is a fake container, and Docker is not really introduced. The so-called container means that every time it runs, the use cases are pulled to a new directory and executed in batches:
4. Generate a report
The pytest command generates an html report, stores it in reports, mounts the page with the help of Django, and clicks from the page to view the report online:
Experience platform
Download source code: https://github.com/dongfanger/pytestx
Installation dependencies: front-end (npm install) back-end (pip install -r requirements.txt)
Start the service: front-end (npm run serve) back-end (python manage.py runserver)
You can enjoy the experience.
study Exchange
Add WeChat cekaigang, join the test and development gang brother exchange group (382 people hit 400 people), let's discuss happily.
References: