Skip to content

Enterprise-Grade Selenium Python Architecture | Scalable Boilerplate with Pytest, Allure & Design Patterns.

License

Notifications You must be signed in to change notification settings

nirtal85/Selenium-Python-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Enterprise-Grade Selenium Python Architecture

The Ultimate Boilerplate for Scalable, Robust, and Modern UI Automation

Twitter Follow YouTube CI Status Nightly Build uv Ruff

View Live Report β€’ Read The Docs β€’ Report Bug


πŸš€ About The Project

This repository serves as a Production-Ready Reference Architecture for building high-scale automated testing frameworks using Python.

It demonstrates advanced design patterns, seamless CI/CD integration, and rich reporting capabilities that define modern Quality Engineering.

✨ Key Features

  • Modern Python Tooling: Built with uv for lightning-fast dependency management and Ruff for linting.
  • Robust Reporting: Full integration with Allure Report, including screenshots, logs, and video.
  • Visual Regression: Integrated with Visual Regression Tracker for pixel-perfect UI validation.
  • CI/CD Ready: Complete GitHub Actions workflows for Nightly runs, PR checks, and Report deployment.

πŸ“ƒ Articles written about this project

This project implements the concepts discussed in the following TestShift articles:


πŸ› οΈ Tech Stack

Tool Description & Why We Use It
Selenium The industry standard for browser automation.
Pytest The most powerful and flexible testing framework for Python.
Allure For beautiful, data-rich test reports including screenshots and logs.
Visual Regression Tracker To catch UI bugs that functional tests miss (Pixel Perfect).
Assertpy An expressive assertion library for readable tests.
Dataclasses JSON Easy serialization of objects for API/Data handling.
MySQL Connector Direct database validation.
Mailinator Client For testing real email delivery workflows.
Tenacity Robust retrying mechanism for flaky network operations.

βš™οΈ Getting Started

1. Clone

git clone https://github.com/nirtal85/Selenium-Python-Example.git
cd selenium-python-example

2. Install (The Modern Way)

We use uv for lightning-fast installations.

Windows:

pip install uv
uv venv
.\env\Scripts\activate
uv sync --all-extras --dev

Mac/Linux:

pip install uv
uv venv
source .venv/bin/activate
uv sync --all-extras --dev

3. Configure

Create a .env file in the project root directory to securely store project secrets. This file is essential for authentication and environment configuration.

EMAIL="your@email.com"
PASSWORD="your_secret_password"
# ... add other variables as needed (see .env.example)

πŸƒβ€β™‚οΈ Execution

Run all tests (Headless Chrome by default):

pytest

Run with specific browser:

pytest --driver firefox

Run specific suite (Tags):

pytest -m sanity

πŸ“Š Results & Reporting

We use Allure for reporting. To view results locally:

Windows (via Scoop):

scoop install allure
allure serve allure-results

Mac (via Brew):

brew install allure
allure serve allure-results

πŸ‘‰ See a Live Example of the Report Here

Found this project useful? If this architecture helped you solve a problem or save time, consider supporting the work!

Buy Me A Coffee


Visit TestShift.com for more Architectural Insights

About

Enterprise-Grade Selenium Python Architecture | Scalable Boilerplate with Pytest, Allure & Design Patterns.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Contributors 6

Languages