TAFLEX PY is a high-performance, enterprise-grade test automation framework built on Python, designed for unified orchestration across Web, API, Mobile, Contract, and BDD (pytest-bdd) testing.
By leveraging the Strategy Pattern and a modular architecture, TAFLEX PY allows teams to write tests once and execute them across multiple platforms and environments with zero code changes.
📖 See documentation: https://vinipx.github.io/taflex-python-modular
- Unified Driver Interface: Single
driverfixture for Playwright (Web), HTTPX (API), and Appium (Mobile). - Behavior-Driven Development (BDD): Native Gherkin support via
pytest-bddintegration. - Enterprise Documentation: Interactive, built-in MkDocs (Material theme) with automated CI/CD deployment.
- Smart Scaffolding: Interactive CLI wizard to generate lightweight, bespoke projects tailored to your tech stack.
- Pact Contract Testing: Full support for Consumer-Driven Contracts (compatible with
pact-pythonv2 and v3+). - Hierarchical Locators: Externalized JSON-based locator management with Global -> Mode -> Page inheritance.
- AI-Ready (MCP): Built-in Model Context Protocol server, enabling AI agents to debug and run tests autonomously.
- Cloud Grid Integration: Native support for BrowserStack and SauceLabs.
TAFLEX PY requires Python 3.10+.
# Clone the repository
git clone https://github.com/vinipx/taflex-python-modular.git
cd taflex-python-modular
# Run the automated setup script
./init.sh
source .venv/bin/activateCreate a new, clean automation project using the interactive wizard:
./scaffold.shThe wizard will ask which modules (Web, API, Mobile, Contract, BDD) and reporters (Allure, ReportPortal, Xray) you need, then generate a ready-to-run project directory.
# Run all tests
pytest
# Run tests with a specific marker
pytest -m web
pytest -m bddTAFLEX PY enforces high code quality and maintainability standards. It includes a built-in ./codechecks.sh script that validates both the architecture and the test coverage of the framework.
- Architecture (Maintainability Index): Evaluated using Radon, ensuring the codebase remains clean, readable, and easy to maintain over time.
- Code Coverage: Measured using
pytest-cov, verifying that core framework utilities and implementations are thoroughly tested.
These checks are integrated into our scaffolded projects by default and run automatically as part of the CI pipelines (GitHub Actions & GitLab CI) to guarantee quality on every commit and pull request.
To run the checks locally:
./codechecks.shTAFLEX PY includes a built-in Model Context Protocol (MCP) server, transforming your test automation framework into an active service that AI agents (like Claude Desktop, Cursor, or specialized CI/CD agents) can securely interact with.
- Introspect Configuration: Agents can read the JSON schema of your configuration and current environment state.
- Execute Tests: Agents can trigger
pytestexecutions and analyze standard output/errors to autonomously debug failures. - Scaffold & Maintain: Agents can read documentation, scaffold new test suites, and write test files natively.
To start the MCP server manually (or point your AI IDE to this command):
# Within your virtual environment
taflex-mcpFor full configuration details with Claude Desktop or Cursor, see the MCP Integration Guide.
TAFLEX PY comes with comprehensive documentation.
- Local Preview: Run
./docs.shto start the local MkDocs server athttp://localhost:8000. - Online Version: View the latest documentation here.
The framework follows a modular strategy where the DriverFactory resolves the correct automation engine at runtime based on your .env configuration or Pytest markers.
flowchart LR
A[Test Suite] --> B[conftest.py]
B --> C{DriverFactory}
C --> D[Playwright Strategy]
C --> E[HTTPX Strategy]
C --> F[Appium Strategy]
We welcome contributions! Please see our Contributing Guidelines for more details.
This project is licensed under the MIT License.