How anhtester/automationframeworkselenium works
Main Components
• Framework Core: This includes the configuration, constants, annotations, driver management, and exception handling found under packages such as “config”, “constants”, “annotations”, “driver”, “enums”, and “exceptions”. These are core building blocks that allow tests to interact with the browsers and manage pre-/post-test actions.
• Test Libraries and Helpers: The “helpers”, “utils”, and “keywords” packages encapsulate common functions (for file handling, data generation, screenshots, logging, etc.) and the WebUI keyword interface that is used by test cases.
• Reporting and Notification Modules: Under the “report” package you have classes for Allure and Extent reporting plus a TelegramManager for sending notifications. The mail package provides functionality for dispatching emails once tests complete.
• Data Providers and Test Suites: The “dataprovider” package and test resources (testdata, test suites in XML, etc.) enable data-driven testing and centralized test execution with TestNG.
• Test Cases and Test Runner: The test code in “src/test” (and its organized projects sub-packages for CMS/CRM modules) represents the TestNG test cases that use the core framework functions.
• External Integration Components: The README details integrations with Selenium Grid for remote and parallel test execution and potentially external reporting tools (e.g., Allure, Extent, Telegram).
Relationships and Interactions
• The Test Runner (TestNG) initiates test cases that call the WebUI keyword functions.
• The WebUI functions internally utilize the DriverManager (along with BrowserFactory and TargetFactory) to instantiate and configure browser sessions as per the configuration (from properties files).
• The framework’s utilities and helpers provide auxiliary functionality – reading configuration (ConfigFactory/Configuration), logging (LogUtils), file operations, and screenshot/video functions.
• Reporting modules (ExtentTestManager, AllureManager) capture test execution data. These then integrate with external systems such as email (EmailAttachmentsSender) and Telegram (TelegramManager) for notifications.
• Data Providers support reading test input from various file formats (Excel, JSON, CSV) and funnel that data into the test cases.
• Selenium Grid functionality is incorporated via configuration properties and driver setup allowing tests to run remotely over a grid.
Architectural Patterns & Design Principles
• Layered Architecture: Separate layers for core infrastructure (setup/configuration), service/util layers (keywords, utilities), and test layer (actual tests and data providers) enhance maintainability.
• Plug-In Extensibility: With dedicated modules for email, reporting, and Selenium Grid integrations, the architecture is extensible and decoupled.
• Test-Driven / Configuration-Centric: With external config (properties files) that control behaviors like parallel execution, screenshot capture, etc., it emphasizes configurability.