How cvenkatreddy/python-selenium-pytest works
Project type and purpose
• This is not a user‐facing app but a test automation framework built in Python. It uses Selenium WebDriver to automate browser actions, Pytest as the test runner, and Allure for reporting. The goal is to provide a maintainable, data‐driven UI testing solution with clear separation of concerns.
File structure
• Top‐level directories:
• data/ ← JSON files containing test data
• globals/ ← global constants and directory paths
• ini_configs/ ← INI configuration files (e.g., environment URLs, credentials)
• pages/ ← Page Object Model classes (base_page.py, sign_page.py)
• tests/ ← Pytest test modules and fixtures (conftest.py, test_*.py)
• utils/ ← helper modules (config_parser.py, json_parser.py)
• CI/CD integration: .github/workflows/python-app.yml triggers tests in GitHub Actions
• Requirements.txt / pipenv manage dependencies; Allure CLI for report generation
README for additional insights
• Describes environment setup (scoop/brew, pipenv, venv)
• Shows Pytest commands and browser options (chrome, firefox, remote)
• Mentions Allure as the reporting engine
a. Main components to represent:
1. CI/CD Pipeline (GitHub Actions)
2. Test Runner (Pytest)
3. Test Suite (tests/ modules + conftest fixtures)
4. Configuration Layer
• INI configs (ini_configs/props.ini)
• globals (globals/dir_global.py)
5. Data Layer (data/tests_data.json)
6. Utility Layer (utils/config_parser.py, utils/json_parser.py)
7. Page Object Layer (pages/base_page.py, pages/sign_page.py)
8. Selenium WebDriver (local or remote browser)
9. Reporting (Allure CLI / allure-results → Allure Report)
10. External Services (e.g., remote Selenium Grid or cloud browser)
b. Relationships and interactions:
• CI/CD Pipeline → triggers Pytest Test Runner
• Test Runner loads Conftest fixtures → reads from Configuration + Globals
• Tests call Utility Layer to parse INI and JSON data → supply parameters to tests
• Tests use Page Objects to perform UI steps → Page Objects invoke Selenium WebDriver APIs
• WebDriver sends commands to the Browser (local or remote) → returns DOM/state
• Test results are captured by Pytest → output raw results to Allure results directory
• Allure CLI reads results → generates interactive HTML report
c. Architectural patterns / design principles:
• Page Object Model: encapsulates locators and actions in page classes
• Layered architecture: clear separation between Test, Page, Utility, Data, Configuration
• Configuration-driven: environment and test data externalized (INI + JSON)
• Plugin-based reporting: Pytest + Allure integration
d. Key technologies/frameworks:
• Python 3.x, Pytest, Selenium WebDriver, Allure CLI
• pipenv/virtualenv for dependency management
• GitHub Actions for CI/CD