A Python-based BDD test automation framework using pytest-bdd and Selenium WebDriver. Includes sample tests for Google Search and MakeMyTrip.com. Designed for easy extension and CI integration.
python-test/
├── README.md
├── requirements.txt
├── config.yml # Centralized configuration for tests and environment
├── configuration/ # Custom config loaders, environment setup scripts
├── forms/ # Page object models or form interaction helpers
├── queries/ # Database or API query utilities for test validation
├── services/ # Service layer mocks, stubs, or integration helpers
├── testdata/ # Sample data files, fixtures, or generators for tests
├── tests/
│ ├── conftest.py
│ ├── features/
│ │ └── google_search.feature
│ ├── test_google_search.py
│ └── test_makemytrip.py
└── venv/
- configuration/: Scripts and modules for loading configs, setting up environments, or managing test settings.
- forms/: Page objects or helpers for interacting with web forms and UI elements.
- queries/: Utilities for querying databases, APIs, or other sources to validate test outcomes.
- services/: Mocks, stubs, or wrappers for external services used in tests.
- testdata/: Static or generated data files used for test input and validation.
- config.yml: Main YAML config file for test parameters, environment variables, or secrets.
- BDD-style test scenarios with pytest-bdd
- Selenium WebDriver automation (Chrome, managed by webdriver-manager)
- Example tests for Google Search and MakeMyTrip.com
- Headless or headed browser runs
- Easily extensible for more scenarios
- Create and activate a virtual environment (Windows PowerShell):
python -m venv venv .\venv\Scripts\Activate.ps1 - Install dependencies:
pip install -r requirements.txt
- Run all tests (headless by default):
pytest -q - Run with a visible browser (for debugging):
$env:PYTEST_HEADLESS=0; pytest -q
- Run a specific test file:
pytest tests/test_google_search.py -q pytest tests/test_makemytrip.py -q
- Add new
.featurefiles intests/features/for BDD scenarios - Add new test modules in
tests/and implement step definitions using pytest-bdd - Use the
driverfixture for Selenium WebDriver access
- Headless mode may behave differently on some sites (Google, MakeMyTrip); use headed mode for debugging if needed
- The framework is ready for CI integration (GitHub Actions, etc.)
Short description for GitHub repo:
Python BDD test automation framework using pytest-bdd and Selenium. Includes sample tests for Google Search and MakeMyTrip.com.