Skip to main content

Architecture Overview

TAFLEX PY is built on a robust, extensible architecture that follows enterprise-grade design patterns. This document explains the architectural decisions and how different components interact.

Design Philosophyโ€‹

TAFLEX PY follows these core principles:

PrincipleDescription
๐Ÿงฉ Strategy PatternRuntime driver resolution allows the same test code to run on Web, API, or Mobile without modification.
๐Ÿ“„ Separation of ConcernsTest logic is completely decoupled from driver implementation and locator definitions.
โš™๏ธ Configuration Over CodeBehavior is controlled through external configuration, not hardcoded values.
๐Ÿงช Fast Feedback LoopHigh-performance execution using Playwright and Pytest for rapid development.

High-Level Architectureโ€‹

Component Breakdownโ€‹

1. Driver Layerโ€‹

The Driver Layer implements the Strategy Pattern, allowing runtime selection of the appropriate driver implementation.

Key Benefits:

  • โœ… Single test codebase for all platforms.
  • โœ… Driver changes (e.g., swapping engines) don't affect test specs.
  • โœ… Supports parallel execution with different strategies.

2. Locator Systemโ€‹

All locators are externalized in JSON files using the LocatorManager.

Locator Loading Order:

  1. global.json - Common across all modes.
  2. {mode}/common.json - Mode-specific common locators.
  3. {mode}/{page}.json - Page/feature-specific locators.

3. Configuration Managementโ€‹

The ConfigManager provides centralized access to validated environment variables:

from src.config.config_manager import config_manager

# Type-safe access with Pydantic validation
browser = config_manager.get('browser')
timeout = config_manager.get('timeout')

4. Test Execution Flowโ€‹

Technology Stackโ€‹

CategoryTechnologies
Core FrameworkPython 3.10+, Pydantic, Pytest
Web TestingPlaywright, Chromium/Firefox/WebKit
BDD TestingGherkin, pytest-bdd
API TestingPlaywright (Hybrid) ยท HTTPX (Specialized)
Mobile TestingAppium
Unit TestingPytest
DatabaseSQLAlchemy, psycopg2, PyMySQL
ReportingAllure, Playwright HTML

Extensibility Pointsโ€‹

TAFLEX PY is designed for extension at multiple levels:

1. Custom Driver Strategiesโ€‹

Simply extend the AutomationDriver base class and register it in the DriverFactory.

2. Custom Element Wrappersโ€‹

Extend or create new element wrappers to support unique platform interactions while maintaining a consistent API.

3. Fixturesโ€‹

Customize Playwright fixtures in conftest.py to inject global setup/teardown logic or custom dependencies.