A robust automation framework developed in Python using Selenium, Pytest, and Behave, combining Behavior-Driven Development (BDD) with the Page Object Model (POM) design pattern.Designed to automate UI test cases for Swag Labs demo website.
- Page Object Model (POM) design pattern
- Behavior-Driven Development (BDD) with Gherkin syntax
- Configuration management with config.ini
- Cross-browser testing support (Chrome, Firefox, Edge)
- Modular and maintainable test architecture
- Utilities for logging and configuration
- Python 3.9 or higher
- Git
- Google Chrome
- Java JDK 8 or higher (required for Allure reporting)
- Poetry
1. Install Poetry
# Windows (PowerShell)
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
# Mac/Linux
pip install poetry
2. Install dependencies
# Clone the repository
git clone https://github.com/SaiVamsiKolla-QA/Python-Selenium-BDD-POM.git
cd Python-Selenium-BDD-POM
# Install all dependencies
poetry install
# Activate the virtual environment
poetry shell
Mac:
brew install allure
Windows (Scoop):
scoop install allure
Windows (Chocolatey):
choco install allure-commandline
Python-Selenium-BDD-POM/
├── features/
│ ├── Pages/ # Page Object classes
│ ├── steps/ # Step definitions for BDD scenarios
│ ├── environment.py # Behave hooks for setup and teardown
│ └── *.feature # Feature files with Gherkin scenarios
├── utilities/
│ ├── init.py # Package initialization
│ ├── screenshot_utils.py # Screenshot capture utilities
│ ├── log_utils.py # Logging utilities
│ └── config_reader.py # Configuration reader utilities
├── Test-artifacts/ # Test execution artifacts
│ ├── Logs/ # Generated log files
│ ├── Reports/ # Test reports
│ └── Screenshots/ # Captured screenshots
├── pyproject.toml # Poetry configuration
├── poetry.lock # Poetry lock file (generated)
└── Testcases-SwagLabs.xlsx # Manual test scenarios
#Run all Test
poetry run behave
# Run all tests with allure reporting
poetry run behave -f allure_behave.formatter:AllureFormatter -o ./Test-artifacts/Reports
# To see the report
allure serve ./Test-artifacts/Reports
- Consistent dependency versions across different environments
- Automatic virtual environment management
- Simplified Workflow: Single command to install all dependencies
- Better dependency resolution and conflict handling
- CI/CD Integration: Easy to integrate with Jenkins and other CI systems
When adding new dependencies to the project:
# Add a new dependency
poetry add package-name
# Add a development dependency
poetry add --group dev package-name