|
1 | | -# Python and GitLabCI for test automation (QA) |
| 1 | +# Python and GitLab CI/CD Testing Cookbook |
2 | 2 |
|
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
| 3 | +Practical examples for building CI/CD-based QA automation workflows with Python, pytest, GitLab CI, Docker, Allure, Slack notifications, and Azure Pipelines. |
8 | 4 |
|
9 | | -Hello! Here you can find examples of |
10 | | -* Code quality checking jobs |
11 | | -* GitLabCI: jobs with pytest execution |
12 | | -* GitLabCI: slack integration |
13 | | -* GitLabCI: Selenium in Docker test execution |
14 | | -* Pytest: slack integration |
15 | | -* Pytest: test parametrization |
16 | | -* Allure: logger messages as steps |
17 | | -* Allure: log each "requests" lib action |
18 | | -* Multi-thread method execution examples |
19 | | -* Sitemap checkers |
20 | | -* Azure pipeline pytest execution |
| 5 | +This repository is a cookbook of reusable examples and patterns for QA engineers, SDETs, and QA leads who want to integrate automated tests, quality checks, reports, and notifications into delivery pipelines. |
21 | 6 |
|
22 | | -## Installation |
23 | | -Must have `python 3.7+` |
| 7 | +## What this project covers |
24 | 8 |
|
25 | | -`pip3 install -r requirements.txt` |
| 9 | +- Python test execution with pytest |
| 10 | +- GitLab CI jobs for automated test runs |
| 11 | +- Dockerized Selenium execution |
| 12 | +- Slack notifications from CI and pytest |
| 13 | +- Allure reporting and logging examples |
| 14 | +- Code quality checks with pylint and Black |
| 15 | +- Test parametrization patterns |
| 16 | +- Multi-thread execution examples |
| 17 | +- Sitemap status checking |
| 18 | +- Azure Pipelines pytest execution |
26 | 19 |
|
27 | | -## Allure reports |
28 | | -Type this in your project console: |
| 20 | +## Scope |
29 | 21 |
|
30 | | -`pytest --alluredir=reports src\test` |
| 22 | +This is not a single production-ready test framework. |
31 | 23 |
|
32 | | -and after test execution type `allure serve reports` then your browser will open reports. |
| 24 | +It is a collection of independent CI/CD testing examples that can be reused, adapted, or combined in real QA automation projects. |
33 | 25 |
|
| 26 | +## How to use this repository |
| 27 | + |
| 28 | +Choose a scenario: |
| 29 | + |
| 30 | +| Scenario | What it demonstrates | |
| 31 | +|---|---| |
| 32 | +| GitLab CI pytest execution | Running automated tests inside GitLab pipelines | |
| 33 | +| GitLab artifacts | Passing and publishing test outputs between jobs | |
| 34 | +| Slack notifications | Sending pipeline/test feedback to team channels | |
| 35 | +| Selenium in Docker | Running browser tests in isolated containers | |
| 36 | +| Allure reporting | Producing readable test reports and logged steps | |
| 37 | +| Code quality checks | Running pylint and formatting checks in CI | |
| 38 | +| Azure Pipelines | Running pytest outside GitLab CI | |
| 39 | +| Sitemap checking | Validating public links and HTTP statuses | |
| 40 | + |
| 41 | +## Quick start |
| 42 | + |
| 43 | +Requirements: |
| 44 | + |
| 45 | +- Python 3.12+ |
| 46 | +- pip |
| 47 | +- Docker, optional, for browser/Selenium examples |
| 48 | +- Allure CLI, optional, for local report generation |
| 49 | + |
| 50 | +Install dependencies: |
| 51 | + |
| 52 | +```bash |
| 53 | +python -m venv .venv |
| 54 | +source .venv/bin/activate |
| 55 | +pip install -r requirements.txt |
| 56 | +``` |
| 57 | + |
| 58 | +Run tests: |
| 59 | + |
| 60 | +```bash |
| 61 | +pytest src/tests |
| 62 | +``` |
| 63 | + |
| 64 | +## Generate Allure report |
| 65 | + |
| 66 | +```bash |
| 67 | +pytest --alluredir=reports src/tests |
| 68 | +allure serve reports |
| 69 | +``` |
| 70 | + |
| 71 | +## Design goals |
| 72 | + |
| 73 | +- keep test feedback close to the delivery pipeline |
| 74 | +- make test results visible and actionable |
| 75 | +- provide reusable CI/CD examples for QA automation teams |
| 76 | +- demonstrate local and CI execution patterns |
| 77 | +- combine tests, quality checks, reports, and notifications |
0 commit comments