Complete automation testing starter kit with pytest plugin, HTML reports, charts, and parallel execution support
Project description
Robo Automation Test Kit
A comprehensive pytest plugin for test automation reporting with interactive HTML reports, chart visualizations, and support for parallel test execution.
Features
- ๐งช Pytest Plugin Integration - Seamless pytest hook-based integration
- ๐ Interactive HTML Reports - Beautiful, interactive test reports with charts
- ๐ Data Visualization - Multiple chart types:
- Test status summary charts
- Category breakdown analysis
- Phase analysis
- Center-based metrics
- Status distribution by center
- ๐ Parallel Execution Support - Built-in support for pytest-xdist
- ๐ CSV/Excel Data Parametrization - Load test data from CSV and Excel files
- ๐จ Customizable Reports - Extend reports with custom attributes and metrics
- ๐ Zero Configuration - Works out of the box with sensible defaults
Installation
Basic Installation
pip install robo-automation-test-kit
With Optional Features
# For parallel test execution
pip install robo-automation-test-kit[parallel]
# For Selenium-based browser automation
pip install robo-automation-test-kit[selenium]
# For system utilities
pip install robo-automation-test-kit[utils]
# For development
pip install robo-automation-test-kit[pytest]
# All features combined
pip install robo-automation-test-kit[pytest,selenium,parallel,utils]
Using Poetry
poetry add robo-automation-test-kit
Quick Start
1. Basic Test Setup
Create a test file tests/test_example.py:
import pytest
class TestExample:
def test_login_success(self):
"""User successfully logs in with valid credentials"""
assert True
def test_dashboard_loads(self):
"""Dashboard page loads and displays correctly"""
assert True
@pytest.mark.skip(reason="Feature not implemented")
def test_future_feature(self):
"""This feature is planned for next release"""
pass
2. Run Tests
# Run with default settings (parallel execution enabled by default)
pytest
# Run serially (disable parallel execution)
pytest -n 1
# Run specific test file
pytest tests/test_example.py::TestExample::test_login_success
3. View Report
After tests complete, open the generated HTML report:
reports/test_report_<timestamp>.html
4. Parameterized Tests with CSV Data
Create test data file data/TestData.csv:
username,password,expected_result
user1@example.com,ValidPass123,success
user2@example.com,WrongPass,failure
user3@example.com,ValidPass456,success
Create test with parametrization tests/test_login.py:
import pytest
class TestLogin:
@pytest.mark.datafile("TestData.csv")
def test_login_with_data(self, row):
"""Login test with parameterized data: {username}"""
username = row['username']
password = row['password']
expected = row['expected_result']
# Your test logic here
result = login(username, password)
assert result == expected
Configuration
pytest.ini
Basic configuration is pre-configured in pytest.ini:
[pytest]
addopts = -n logical --capture=tee-sys
markers =
datafile: Mark test to use CSV/Excel data parametrization
Environment Variables
Control test behavior via environment variables:
# Windows PowerShell
$env:LOG_LEVEL="DEBUG"
$env:PARALLEL_EXECUTION="N" # Disable parallel execution
$env:PROJECT_NAME="My Project"
$env:APP_ENV="staging"
$env:TEST_FRAMEWORK="pytest"
# Run tests
pytest
# Linux/macOS
export LOG_LEVEL=DEBUG
export PARALLEL_EXECUTION=N
export PROJECT_NAME="My Project"
pytest
Dynamic Logging
Control pytest log level at runtime:
# Windows PowerShell
$env:LOG_LEVEL="WARNING"
pytest --log-cli-level=$env:LOG_LEVEL
# Linux/macOS
export LOG_LEVEL=WARNING
pytest --log-cli-level=$LOG_LEVEL
Valid log levels: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET
Advanced Usage
Customize Report Titles
pytest --robo-report-title="Smoke Tests - Sprint 45"
Custom Report Attributes
Extend conftest.py with the robo_modify_report_row hook:
def robo_modify_report_row(report_row, test_data):
"""Add custom attributes to each test result"""
report_row['phase'] = test_data.get('Phase', 'General')
report_row['category'] = test_data.get('Request Category', 'Functional')
report_row['center'] = test_data.get('Center', 'HQ')
Disable Parallel Execution Conditionally
# Via environment variable
export PARALLEL_EXECUTION=N
pytest
# Via command line
pytest -n 1
Report Structure
Generated HTML reports include:
- Summary Dashboard - Quick overview of test results
- Status Charts - Visual breakdown of PASSED/FAILED/SKIPPED tests
- Category Analysis - Test distribution by category
- Phase Breakdown - Test distribution by phase
- Results Table - Detailed results with test names, duration, status, and logs
- Error Details - Full error messages and stack traces for failed tests
Architecture
robo_automation_test_kit/
โโโ plugin.py # Pytest hook implementations
โโโ hookspec.py # Hook specifications
โโโ utils/
โ โโโ RoboHelper.py # Core utilities (CSV loading, result aggregation)
โ โโโ reports/
โ โโโ HtmlReportUtils.py # HTML generation
โ โโโ EmailReportUtils.py # Email notifications (future)
โโโ templates/
โโโ html_report/
โโโ html_template.html # Main template
โโโ components/
โโโ summary-chart.html
โโโ category-chart.html
โโโ phase-chart.html
โโโ center-chart.html
โโโ status-center-chart.html
โโโ results-table.html
Data Flow
- Tests execute via pytest (with optional xdist parallelization)
- Plugin captures test results via
pytest_runtest_makereporthook - Custom attributes injected via
robo_modify_report_rowhook - Results aggregated in
pytest_sessionfinish - HTML report generated in
pytest_unconfigure
Extension Points
Custom Report Metrics
Modify RoboHelper.aggregate_test_results() to compute custom metrics:
def robo_modify_report_row(report_row, test_data):
"""Custom metric: Execution environment"""
report_row['environment'] = os.getenv('APP_ENV', 'production')
report_row['execution_date'] = datetime.now().strftime('%Y-%m-%d')
Email Notifications
Extend pytest_unconfigure hook in conftest to send reports via email:
from robo_automation_test_kit.utils.reports.EmailReportUtils import send_report
def pytest_unconfigure(config):
"""Send report via email after test completion"""
report_path = config.robo_report_path
send_report(report_path, to_addresses=['team@example.com'])
Troubleshooting
Missing Test Attributes
- Verify
robo_modify_report_row()is defined inconftest.py(not plugin.py) - Ensure CSV columns match field names in the hook
Template Not Found
- Check
templates/html_report/directory exists in project root - Verify templates are included in package via
MANIFEST.in
CSV Encoding Errors
- Plugin automatically tries: utf-8-sig โ latin-1 โ utf-8
- For manual fixes, ensure CSV is UTF-8 encoded
Parallel Execution Issues
- Verify pytest-xdist is installed:
pip install pytest-xdist - Check
pytest.inihas-n logicaloption - Disable via
PARALLEL_EXECUTION=Nor-n 1
Common Commands
# Run all tests with default parallel execution
pytest
# Run serially (no parallelization)
pytest -n 1
# Run specific test
pytest tests/test_example.py::test_function
# Run with verbose output
pytest -v
# Run with specific log level
pytest --log-cli-level=DEBUG
# Run only failed tests from last run
pytest --lf
# Show print statements
pytest -s
# Generate report with custom title
pytest --robo-report-title="Custom Title"
Development
Local Development Setup
# Install in editable mode with all dev dependencies
poetry install
# Run tests
poetry run pytest
# Build package
poetry build
# Publish to PyPI (requires credentials)
poetry publish
Prerequisites
- Python 3.8+
- pytest >= 7.4.0
- pandas >= 2.2.0
- jinja2 >= 3.0.0
License
MIT License - see LICENSE file for details
Contributing
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes and add tests
- Commit with clear messages (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Support
For issues, questions, or suggestions:
- Open an issue on GitHub
- Check existing documentation
- Review test examples in
tests/directory
Related Projects
- pytest - Testing framework
- pytest-xdist - Parallel test execution
- pandas - Data manipulation
- Jinja2 - Template engine
Changelog
Version 1.0.0 (2026-02-03)
- Initial release
- Pytest plugin with HTML reporting
- CSV/Excel parametrization
- Parallel execution support (xdist)
- Interactive chart visualizations
- Customizable report attributes
Happy Testing! ๐งช
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file robo_automation_test_kit-1.0.2.tar.gz.
File metadata
- Download URL: robo_automation_test_kit-1.0.2.tar.gz
- Upload date:
- Size: 108.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.12.1 Linux/6.8.0-1030-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7a545d9286d04c54ef1579dc54ccf749935e757c1ab612b735cb93df31ab164
|
|
| MD5 |
ce17eb4e1dfb35e6213509129ce397ce
|
|
| BLAKE2b-256 |
cdc67ff3c9bf3ed20a3414fd7ba145ed22cf342d781a3785c06e406f68a1bf8e
|
File details
Details for the file robo_automation_test_kit-1.0.2-py3-none-any.whl.
File metadata
- Download URL: robo_automation_test_kit-1.0.2-py3-none-any.whl
- Upload date:
- Size: 117.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.12.1 Linux/6.8.0-1030-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75a042ea25bdab3b76d70c9b44efed20cf01b12b50c35897242d8bc1f4b37ba8
|
|
| MD5 |
e1ec6a21fef9f19d7d95de8765dd5ab7
|
|
| BLAKE2b-256 |
ade01582fc34eab09b6b095af831c3f5f2cf9c61881cd2c94f0591a607f1ad64
|