Developers Guide
This guide is for developers who want to extend TAFLEX PY or integrate it into their CI/CD pipelines.
Extending the Framework
Adding a New Strategy
To add support for a new platform, create a new class extending AutomationDriver in src/core/drivers/strategies/.
from src.core.drivers.automation_driver import AutomationDriver
class MyNewStrategy(AutomationDriver):
# Implement abstract methods
pass
Then, register it in src/core/drivers/driver.factory.ts.
BDD Integration (Gherkin)
TAFLEX PY uses pytest-bdd to bridge Gherkin and Playwright.
Generation Process
When running BDD tests, the framework executes pytest-bdd. This command:
- Scans
tests/bdd/features/*.feature. - Scans
tests/bdd/steps/*.tsandtests/fixtures.ts. - Generates executable Playwright spec files in the
.features-gen/directory.
The test:bdd script in package.json automates this process.
Unit Testing
Always add unit tests for core framework logic. We use Pytest for its speed and modern API.
pytest tests/unit
CI/CD Integration
TAFLEX PY is designed to run in headless environments. Ensure you pass the required environment variables.
GitHub Actions Example
- name: Run tests
run: pytest tests/
env:
BASE_URL: ${{ secrets.BASE_URL }}
API_BASE_URL: ${{ secrets.API_BASE_URL }}
Type Safety with Pydantic
If you add new configuration parameters, update the ConfigSchema in src/config/config_manager.py. This ensures that any missing or invalid configuration is caught immediately at runtime.
Code Hygiene & Formatting
To maintain high code quality and consistency across the project, we use Ruff and Mypy.
Linting
Checks for potential errors and adherence to coding standards:
ruff check . && mypy src/
Automatic Formatting
Fixes formatting and simple linting issues automatically:
ruff check --fix .
All contributions must pass the linter before being merged into the main branch.