Skip to content

Sahaj7809/py-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python BDD Test Framework (pytest-bdd)

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.

Project Structure

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/

Folder Descriptions

  • 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.

Features

  • 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

Setup

  1. Create and activate a virtual environment (Windows PowerShell):
    python -m venv venv
    .\venv\Scripts\Activate.ps1
  2. Install dependencies:
    pip install -r requirements.txt

Running Tests

  • 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

Adding New Tests

  • Add new .feature files in tests/features/ for BDD scenarios
  • Add new test modules in tests/ and implement step definitions using pytest-bdd
  • Use the driver fixture for Selenium WebDriver access

Notes

  • 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.

About

Python-based BDD test automation framework using pytest-bdd and Selenium WebDriver

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors