Modern Python test automation framework for UI and API testing with pytest, Playwright, and requests.
TestForge is a reusable automation framework designed for teams that want a clean Python foundation for UI and API testing. It is structured like a real automation repository rather than a single-script demo. It includes:
- UI automation foundation with Playwright
- API automation foundation with requests
- environment-driven configuration
- reusable fixtures
- page-object ready structure
- logging and reporting hooks
- API schema validation
- reusable assertion helpers
- smoke and regression markers
- example API and UI tests
- Test runner:
pytest - UI automation:
Playwright - API automation:
requests - Config management:
pydantic+.env - Reporting:
pytest-html - Parallel execution:
pytest-xdist
TestForge/
├── src/framework/
│ ├── api/
│ ├── config/
│ ├── core/
│ ├── pages/
│ └── utils/
├── tests/
│ ├── api/
│ ├── fixtures/
│ └── ui/
├── reports/
├── scripts/
├── .env.example
├── pyproject.toml
├── pytest.ini
└── README.md
- Centralized runtime configuration
- API client abstraction
- API schema validation with Pydantic models
- Browser/session lifecycle management
- Base page object support
- Better reusable assertions for response and payload validation
- Custom pytest hooks and markers
- HTML reporting
- Parallel execution support
- Easy extension for web, API, and service-layer automation
cd /Users/abdullahahmed/TestForge
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
playwright install
cp .env.example .envIf you want developer tooling too:
pip install -e ".[dev]"Run all tests:
pytestRun only API tests:
pytest -m apiRun only UI tests:
pytest -m uiRun smoke tests in parallel:
pytest -m smoke -n autoAfter execution, an HTML report is generated at:
reports/report.html
Environment values are loaded from .env.
Example:
BASE_URL=https://www.saucedemo.com
API_BASE_URL=https://jsonplaceholder.typicode.com
BROWSER=chromium
HEADLESS=true
TIMEOUT_SECONDS=15- API test for JSONPlaceholder
- UI smoke test structure using the SauceDemo login page
The sample API test demonstrates:
- status-code assertion helpers
- JSON payload key assertions
- Pydantic schema validation for API responses
- Add more page objects under
src/framework/pages/ - Add domain-specific API clients under
src/framework/api/ - Add shared assertions and helpers under
src/framework/utils/ - Add API response models under
src/framework/api/schemas.py - Group tests by feature area under
tests/api/andtests/ui/
- Allure reporting
- database validation layer
- contract testing
- CI pipeline
- Dockerized execution
- visual regression support