- 100+ automated tests across frontend, API, and database
- Parallel execution using pytest-xdist
- CI/CD ready: GitLab CI, GitHub Actions, Jenkins
- HTML, JUnit, and Allure reporting with screenshots on failure
A professional-grade test automation framework designed for E-Commerce applications built with WordPress and WooCommerce. It covers frontend (using Selenium), API, and database testing using Python and PyTest, and integrates with CI/CD systems like GitLab CI, GitHub Actions, and Jenkins. Developed to simulate real-world automation workflows, reporting, and environments.
E-Commerce Website Under Test: Demo Store
- Comprehensive Test Coverage: 100+ tests covering frontend, backend, and database layers
- Advanced Reporting:
- HTML reports with detailed test execution information
- Allure reports with beautiful dashboards and analytics
- Automatic screenshot capture on test failures
- CI/CD Integration:
- GitLab CI pipeline configuration
- Jenkins pipeline setup
- GitHub Actions workflow
- Parallel Execution: Optimized test execution across multiple workers
- End-to-End Testing: Comprehensive test coverage for both frontend and backend
- API Testing: Robust API test suite for WooCommerce endpoints
- Database Testing: Integration with MySQL for data validation
- Cross-Browser Support: Test execution across multiple browsers
- Docker Support: Containerized test execution environment

HTML test report with detailed execution information

Allure Report Dashboard showing test execution overview

Automatically captured screenshot on test failure (Allure)

Automatically captured screenshot on test failure (pytest-html)
- Programming Language: Python 3.13+
- Testing Framework: PyTest
- Web Automation: Selenium WebDriver
- API Testing: Requests library
- Database: MySQL
- Containerization: Docker
- CI/CD: GitLab CI, Jenkins, GitHub Actions
- Parallel Testing: pytest-xdist
The framework follows a modular architecture with a clear separation between test layers and utility logic. Tests are structured using the Page Object Model for frontend coverage, helper modules for API and database testing, and configuration files to support multiple environments.
The automation flow involves:
- Selenium-based UI tests interacting with a live WooCommerce frontend
- REST API tests targeting WooCommerce endpoints
- MySQL integration to verify backend data consistency
- CI/CD pipelines (Jenkins, GitLab CI, GitHub Actions) automatically triggering tests and publishing reports
- Allure and HTML reporting for detailed visibility
Overall architecture showing test layers, CI triggers, and reporting flow
- Python 3.13 or higher
- Docker (optional, for containerized execution)
- Access to a WordPress + WooCommerce site with StoreFront theme
- MySQL database access
To get the most out of this framework, users can set up their own local WordPress + WooCommerce site for testing. This provides complete control over the test environment and allows for safe experimentation.
Follow the comprehensive written guide to set up a local testing environment: Setting Up WordPress & WooCommerce for Testing
Watch the step-by-step video series:
- Part 1: Installing WordPress
- Part 2: Configuring The Site
- Part 3: Verifying API and Frontend Checkout
These resources guide users through:
- Setting up a local development environment
- Installing and configuring WordPress
- Setting up WooCommerce
- Creating test products and categories
- Setting up API keys for testing
- Verifying the checkout process
- Clone the repository (choose one based on your preferred CI/CD platform):
# For GitHub
git clone https://github.com/cesedebe/E-comm-pytest-automation.git
# For GitLab
git clone git@gitlab.com:cesedebe/E-comm-pytest-automation.git
cd qa-bootcamp-framework
Note: The same codebase is maintained in both GitHub and GitLab to provide hands-on experience with different CI/CD platforms. Choose the repository that aligns with your learning goals:
- GitHub repository for GitHub Actions
- GitLab repository for GitLab CI
- Either repository can be used with Jenkins CI
- Set up virtual environment and install dependencies:
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
-
Configure environment variables (see Configuration section below)
-
Run tests:
cd demostore_automation
python3 -m pytest tests
The framework uses environment variables for configuration. Create a variables_local.sh
(Linux/Mac) or variables_local.bat
(Windows) file with the following variables:
export BASE_URL=<your_website_url>
export BROWSER=<browser_name> # chrome, firefox, headlesschrome,...
export RESULTS_DIR=$(pwd)/results
export DB_PORT=<your_database_port>
export DB_HOST=<your_database_host>
export DB_DATABASE=<your_database_name>
export DB_TABLE_PREFIX=<table_prefix> # typically wp_ for WordPress
export WOO_KEY=<your_woocommerce_key>
export WOO_SECRET=<your_woocommerce_secret>
export DB_USER=<your_db_user>
export DB_PASSWORD=<your_db_password>
The framework uses pytest-xdist for parallel test execution, providing significant speed improvements for large test suites. Tests are distributed across multiple workers, with each worker running its own browser instance.
Parallel execution is configured in pytest.ini
with the following settings:
addopts = -n auto --dist=loadscope
-n auto
: Automatically determines the optimal number of workers based on CPU cores--dist=loadscope
: Groups tests by module/class to maintain test isolation
# Run all tests in parallel
pytest tests/
# Run specific test directory in parallel
pytest tests/frontend/
# Run with specific number of workers
pytest -n 4 tests/
# Run tests sequentially
pytest -n 0 tests/
# Run specific test file sequentially
pytest -n 0 tests/frontend/test_login.py
# Run tests by marker
pytest -n 0 -m smoke tests/ # Run all tests marked with @pytest.mark.smoke
pytest -n 0 -m "not smoke" tests/ # Run all tests not marked with @pytest.mark.smoke
- Tests are grouped by module/class using
--dist=loadscope
- This ensures related tests run on the same worker
- Each worker gets its own browser instance and profile
- Browser profiles are stored in
/tmp/
with worker-specific identifiers
- Test Isolation: Ensure tests are properly isolated and don't share state
- Resource Management: Monitor system resources when running in parallel
- Debugging: Use
-n 0
for easier debugging of specific tests - CI/CD: Parallel execution is ideal for CI/CD pipelines to reduce execution time
This project separates test code and supporting logic into two main folders:
demostore_automation/
: Contains all tests (frontend, backend, health checks)src/
: Contains reusable modules such as page objects, API utilities, data access, and custom Selenium extensions
This separation helps maintain clean architecture and enables easier reuse of logic across test suites.
demostore_automation/
├── tests/
│ ├── frontend/ # UI automation tests
│ ├── backend/ # API and database tests
│ └── test_healthcheck.py # Health check tests
├── src/
│ ├── pages/ # Page object models
│ ├── api_helpers/ # API helper functions
│ ├── generic_helpers/ # Generic helper functions
│ ├── selenium_extended/ # Extended Selenium functionality
│ ├── configs/ # Configuration files
│ ├── dao/ # Data Access Objects
│ ├── utilities/ # Utility functions
│ └── data/ # Test data
├── scripts/ # Utility scripts
├── pytest.ini # pytest configuration
└── conftest.py # pytest fixtures and hooks
- Run all tests:
python3 -m pytest tests
- Run frontend tests:
python3 -m pytest tests/frontend
- Run backend tests:
python3 -m pytest tests/backend
- Run specific test:
python3 -m pytest tests -m tcid33
The framework supports three types of test reports, each with its own advantages:
HTML reports provide a straightforward way to view test results with basic information about test execution.
# Run tests with HTML report generation
cd demostore_automation
python3 -m pytest tests --html=reports/report.html
# View the report
open reports/report.html # On Mac
# or
start reports/report.html # On Windows
HTML reports include:
- Test execution status (passed/failed)
- Test duration
- Error messages for failed tests
- Basic test information
- Screenshot of page if a test fails
JUnit XML reports are particularly useful for CI/CD integration and test result analysis in various tools.
# Run tests with JUnit XML report generation
cd demostore_automation
python3 -m pytest tests --junitxml=reports/junit.xml
JUnit reports are used by:
- Jenkins for test result visualization and trend analysis
- GitLab CI for test result parsing and reporting
- GitHub Actions for test result integration
- Various test result visualization tools
- Test result aggregation platforms
Allure reports provide a more sophisticated and visually appealing way to analyze test results, with detailed information and analytics.
The process involves three sequential steps:
- First, run tests and collect Allure results:
cd demostore_automation
python3 -m pytest tests --alluredir=./allure-results
- Then, generate the HTML report from the collected results:
allure generate ./allure-results -o ./allure-report --clean
- Finally, you can view the report in one of two ways:
- Serve the report locally (temporary server):
allure serve ./allure-results
- Or open the generated HTML report directly:
open ./allure-report/index.html # On Mac # or start ./allure-report/index.html # On Windows
Note: The
allure serve
command creates a temporary web server to view the report, whileallure generate
creates static HTML files that can be shared or hosted.
Allure reports provide:
- Test execution history
- Detailed test case information
- Step-by-step test execution
- Screenshots and attachments
- Test categorization and grouping
- Historical trends and statistics
- Use HTML reports for quick, simple test result viewing
- Use JUnit reports for CI/CD integration and test result analysis
- Use Allure reports for detailed analysis, historical trends, and beautiful visualization
This framework integrates with:
- GitLab CI via
.gitlab-ci.yml
- Jenkins using a
Jenkinsfile
located in the root directory - GitHub Actions using
.github/workflows/main.yml
Each pipeline automatically:
- Installs dependencies
- Activates the Python virtual environment
- Loads environment variables securely
- Runs frontend and backend test suites
- Publishes reports (HTML, JUnit, Allure)
- Sends results to the Automation Dashboard (if configured)
You can view example pipelines in the screenshots section above.
- Creating E-Commerce Site for Testing - Part 1
- Creating E-Commerce Site for Testing - Part 2
- Creating E-Commerce Site for Testing - Part 3
For questions or support, please open an issue in the repository.