How ashraaf7/taf works
Project Type and Purpose
• This is a Test Automation Framework (TAF) written in Java, combining Selenium for UI testing and Rest Assured for API testing.
• It’s designed as an open-source, modular, data-driven, cross-browser test framework with CI/CD integration and custom reporting.
File Structure Analysis
• Top-level modules and files:
• pom.xml (Maven build)
• .github/workflows (CI pipeline definitions)
• src/main/java/com/automationexercices:
• apis (Builder, UserManagementAPI)
• drivers (AbstractDriver, Browser enum, BrowserFactory classes, WebDriverProvider, GUIDriver, UITest)
• pages & pages/components (Page Object Model classes, reusable UI components)
• listeners (TestNGListeners)
• media (ScreenshotsManager, ScreenRecordManager)
• utils (OSUtils, TerminalUtils, TimeManager, WaitManager, actions, dataReader, logs, report)
• validations (custom assertion wrappers)
• src/test/java:
• BaseTest scaffold, UI tests, API tests.
• resources (environment configs, Allure/Log4j/driver extensions).
README Insights
• Key features: modular design, POM, Factory & Builder patterns, parallel execution, data-driven JSON/Excel, custom listeners, custom reports (Allure), CI/CD (GitHub Actions).
• Supported technologies: Selenium, Rest Assured, TestNG, Maven, Log4j, Allure, Apache POI, Faker.
Main System Components
a. Test Layer
• UI Test Cases (CartTest, CheckoutTest, etc.)
• API Test Cases (RegisterTestAPI)
• BaseTest (initializes WebDriverProvider, TestNGListeners, environment config)
b. Test Runner & Orchestration
• TestNG/JUnit engine
• GitHub Actions workflow
c. Core Framework Modules
• WebDriverProvider & DriverFactories (ChromeFactory, FirefoxFactory, etc.) using Factory pattern
• AbstractDriver & Browser (singleton driver management)
• Page Objects & UI Components (POM classes)
• API Clients (Builder pattern for building API requests, UserManagementAPI)
• Utilities
• dataReader (JSON, Excel, properties)
• actions (ElementActions, BrowserActions, FrameActions, AlertActions)
• WaitManager, TimeManager, OSUtils, TerminalUtils
• Media Managers (ScreenshotsManager, ScreenRecordManager)
• Logging & Reporting
• LogsManager (Log4j2)
• AllureAttachmentManager, AllureReportGenerator, TestNGListeners
d. External Services & Infrastructure
• AUT Web Application under test
• API endpoints (e.g., user management service)
• Selenium Grid / Browser nodes (configured via seleniumGrid.properties)
• CI/CD runner (GitHub Actions)
Relationships and Data Flows
• Tests → TestNG → BaseTest → WebDriverProvider → DriverFactory → Browser instance → Selenium Grid or local browser → AUT
• UI Tests → Page Objects → ElementActions → WebDriver
• API Tests → Builder → Rest Assured → API service
• Utils & dataReader → provide test data/config to tests and framework
• Media Managers & Listeners → capture screenshots/videos, attach to Allure
• CI/CD → triggers TestNG suite → publishes Allure reports
Architectural Patterns & Principles
• Page Object Model for UI abstraction
• Factory pattern for browser instantiation
• Builder pattern for API request creation
• Singleton/WebDriverProvider for managing driver lifecycle
• Modular, layered structure for separation of concerns
• Data-driven approach (JSON/Excel)