Menu

Overview

Relevant source files

Purpose and Scope

The AutomationFrameworkSelenium is a production-grade test automation framework for web applications using Selenium WebDriver 4.37.0, Java 17, and TestNG 7.11.0. The framework is built by Anh Tester and maintained at github.com/anhtester/AutomationFrameworkSelenium

Core Architecture Components:

LayerKey ClassesPurpose
Build Systempom.xml, FrameworkConstants, config.propertiesMaven-based dependency management with 25+ libraries
Driver ManagementDriverManager, BrowserFactory, TargetFactoryThreadLocal WebDriver management supporting local and remote execution
Keyword EngineWebUI, external keywords Git submodule200+ reusable automation keywords wrapping Selenium API
Test ExecutionBaseTest, TestListener, AllureListenerTestNG-based lifecycle management with dual listener support
Page ObjectsCommonPageCRM, ClientPageCRM, SignInPageCRM, LoginPageCMSPage Object Model implementation for CRM and CMS applications
Data ManagementExcelHelpers, DataProviderManager, JsonUtils, DataFakerUtilsMulti-source test data handling (Excel, JSON, synthetic data)
ReportingExtentReportManager, AllureManager, TelegramManager, EmailSendUtilsMulti-channel reporting (HTML, PDF, Allure, Telegram, Email)
UtilitiesCaptureHelpers, LogUtils, ZipUtils, FileHelpersScreenshot capture, logging, file operations, compression

Execution Modes:

  • Local Execution: Direct browser instantiation via BrowserFactory enum (CHROME, EDGE, FIREFOX, SAFARI)
  • Remote Execution: Selenium Grid connection through TargetFactory with Docker Compose support
  • Parallel Execution: TestNG suite-level and method-level parallelization
  • CI/CD Integration: GitHub Actions workflow with artifact upload

This overview provides a high-level introduction to framework architecture and capabilities. Detailed subsystem documentation is available in dedicated pages covering build configuration (page 2), core architecture (page 3), configuration system (page 4), test execution (page 5), reporting (page 6), helper utilities (page 7), and CI/CD integration (page 8).

Sources: README.md1-28 pom.xml7-12 pom.xml23-70 CHANGELOG.txt1-6

Framework Architecture and Layer Organization

The AutomationFrameworkSelenium implements a nine-layer architecture with clear separation of concerns. Each layer encapsulates specific functionality and exposes well-defined interfaces to adjacent layers.

High-Level Architecture with Subsystem Importance Scores

The diagram illustrates the complete framework organization with importance scores derived from code frequency metrics. The Build & Configuration Layer (importance: 139.25) forms the foundation with pom.xml managing 25+ Maven dependencies and config.properties centralizing runtime settings. The WebUI Abstraction Layer (importance: 69.59) is critical, consisting of an external Git submodule (github.com/anhtester/keywords.git) providing reusable keyword implementations that are exposed through the WebUI static class. The CI/CD & Infrastructure layer (importance: 33.15) automates the entire pipeline through GitHub Actions and supports distributed execution via Docker Selenium Grid.

Sources: pom.xml1-296 README.md236-587 src/main/java/com/anhtester/constants/FrameworkConstants.java src/main/java/com/anhtester/keywords/WebUI.java src/main/java/com/anhtester/driver/ src/test/java/com/anhtester/common/BaseTest.java src/test/java/com/anhtester/listeners/TestListener.java

Test Execution Flow and Component Interaction

The framework orchestrates test execution through a well-defined sequence of component interactions, from browser initialization through test execution to report generation.

Complete Test Execution Sequence

This sequence diagram traces the complete execution path from Maven command invocation through test execution to multi-channel report generation. Key aspects include:

  • ThreadLocal WebDriver Management: DriverManager stores WebDriver instances in ThreadLocal storage, enabling safe parallel test execution
  • Data-Driven Testing: DataProviderManager integrates with ExcelHelpers to feed test data from Excel files (e.g., ClientsDataExcel.xlsx)
  • Smart Wait Strategy: WebUI applies multiple wait conditions (waitForElementVisible, waitForElementClickable, waitForPageLoaded) before element interactions
  • Dual Reporting: Both TestListener (ExtentReports) and AllureListener (Allure) capture test results independently
  • Post-Execution Actions: TestListener.onFinish() triggers report generation, compression (via ZipUtils), and distribution (via TelegramManager)

Sources: src/test/java/com/anhtester/common/BaseTest.java src/main/java/com/anhtester/driver/DriverManager.java src/main/java/com/anhtester/driver/BrowserFactory.java src/main/java/com/anhtester/driver/TargetFactory.java src/main/java/com/anhtester/keywords/WebUI.java src/test/java/com/anhtester/listeners/TestListener.java src/test/java/com/anhtester/listeners/AllureListener.java src/test/java/com/anhtester/dataprovider/DataProviderManager.java

Key Framework Features and Capabilities

The framework provides comprehensive testing capabilities across eight functional domains, each with specific implementation classes and configuration options.

Feature CategoryKey Classes and FilesCapabilities and Configuration
Test ExecutionTestNG 7.11.0
BaseTest
TestListener
AllureListener
- Parallel suite execution (thread-count in XML)
- Method-level parallelization (parallel="methods")
- Test lifecycle hooks (@BeforeMethod/@AfterMethod)
- Retry failed tests via IRetryAnalyzer
- Custom @FrameworkAnnotation for metadata
Browser ManagementDriverManager
BrowserFactory enum
TargetFactory
config.properties
- Multi-browser support: CHROME, EDGE, FIREFOX, SAFARI
- Headless mode (HEADLESS=true)
- Local execution (TARGET=local)
- Remote execution (TARGET=remote, REMOTE_URL, REMOTE_PORT)
- ThreadLocal WebDriver for parallel safety
Keyword LibraryWebUI static class
keywords Git submodule
github.com/anhtester/keywords.git
- 200+ automation keywords
- Navigation: openWebsite(), navigateToUrl(), refreshPage()
- Interaction: clickElement(), setText(), selectOptionByText()
- Wait strategies: waitForElementVisible(), waitForPageLoaded(), smartWait()
- Verification: verifyElementPresent(), verifyElementTextEquals(), softAssert()
- Advanced: screenshotElement(), Authentication(), dragAndDropHTML5()
Data ManagementExcelHelpers
DataProviderManager
JsonUtils
PropertiesHelpers
DataFakerUtils
net.datafaker:datafaker 2.4.4
- Excel file reading (setExcelFile(), getCellData(), getDataHashTable())
- JSON parsing (JsonUtils.get(key))
- Properties file loading (PropertiesHelpers.loadPropertiesFile())
- CSV support via Apache POI
- Synthetic data generation (DataFakerUtils wrapping DataFaker library)
- TestNG @DataProvider integration
Reporting & NotificationsExtentReportManager
AllureManager
TelegramManager
EmailSendUtils
com.aventstack:extentreports 5.1.2
io.qameta.allure:allure-testng 2.29.1
- ExtentReports HTML/PDF output (exports/ExtentReports/)
- Allure JSON results (target/allure-results/)
- Telegram Bot notifications (SEND_REPORT_TO_TELEGRAM=yes)
- Email reports with SMTP (SEND_EMAIL_TO_USERS=yes)
- Screenshot attachment to reports
- Test counters and execution summary
Capture & RecordingCaptureHelpers
ScreenRecoderHelpers
com.github.stephenc.monte:monte-screen-recorder 0.7.7.0
- Screenshot capture (captureScreenshot(), getScreenshot())
- Conditional capture: SCREENSHOT_PASSED_STEPS, SCREENSHOT_FAILED_STEPS, SCREENSHOT_SKIPPED_STEPS, SCREENSHOT_ALL_STEPS
- Video recording (VIDEO_RECORD=yes)
- Screenshot export to exports/ExportData/Images/
- Video export to exports/ExportData/Videos/
LoggingLogUtils
log4j2.properties
org.apache.logging.log4j:log4j-core 2.24.3
- Log4j2 framework integration
- Console appender (StdoutAppender)
- Rolling file appender (exports/logs/applog.log)
- Time-based rotation (daily)
- Size-based rotation (10MB trigger)
- 20 archived logs retention
- Methods: LogUtils.info(), LogUtils.pass(), LogUtils.error()
Configuration & ConstantsFrameworkConstants
PropertiesHelpers
ConfigFactory
config.properties
data.properties
- Centralized constants: URL_CRM, URL_CMS_ADMIN, URL_CMS_USER
- Wait timeouts: WAIT_IMPLICIT, WAIT_EXPLICIT, WAIT_PAGE_LOADED, WAIT_SLEEP_STEP
- Browser settings: BROWSER, HEADLESS, REMOTE_URL, REMOTE_PORT
- Report paths: EXTENT_REPORT_FOLDER, ALLURE_RESULTS_PATH
- Notification config: TELEGRAM_TOKEN, TELEGRAM_CHATID, email credentials
- Property file loading at runtime via PropertiesHelpers

Sources: README.md9-27 pom.xml72-296 src/main/java/com/anhtester/keywords/WebUI.java src/main/java/com/anhtester/helpers/ExcelHelpers.java src/main/java/com/anhtester/report/ExtentReportManager.java src/main/java/com/anhtester/report/AllureManager.java src/main/java/com/anhtester/report/TelegramManager.java src/main/java/com/anhtester/helpers/CaptureHelpers.java src/main/java/com/anhtester/utils/LogUtils.java src/main/java/com/anhtester/constants/FrameworkConstants.java

Framework Evolution and Version History

The framework has evolved continuously since April 2022, with regular updates maintaining compatibility with latest Selenium releases and browser versions through Chrome DevTools Protocol (CDP) updates.

Version History and Technical Stack Evolution

VersionRelease DateSelenium VersionCDP SupportKey Changes and Class Updates
v2.6.5Oct 22, 20254.37.0CDP 141Current version. Updated WebUI keyword class
v2.6.2Jul 19, 20254.34.0CDP 138Maintained CDP compatibility
v2.6.1Jun 13, 20254.33.0CDP 137Selenium update
v2.6.0May 05, 20254.32.0CDP 136Updated FileHelpers, SystemHelpers, ExcelHelpers classes. Upgraded all library versions
v2.5.0Feb 23, 20254.29.0CDP 133Reorganized package structure to com.anhtester.reports
v2.4.9Jan 25, 20254.28.1CDP 132Selenium version update
v2.4.8Dec 17, 20244.27.0CDP 131Enhanced waitForElementVisible() in WebUI class
v2.4.7Nov 1, 20244.26.0CDP 130Selenium update
v2.4.6Oct 29, 20244.25.0-Fixed headless mode on Jenkins Server Linux. Updated dependencies
v2.4.5Sep 7, 2024--Optimized WebUI keyword methods. Removed QR Code handling (google.zxing)
v2.4.4Sep 5, 20244.24.0CDP 128Selenium update
v2.4.3Aug 14, 20244.23.1-Upgraded all libraries to latest versions
v2.4.2Jul 26, 20244.23.0CDP 127Updated CDP support in WebUI keyword
v2.4.1Jun 24, 20244.22.0CDP 126Updated CDP implementation in WebUI
v2.4.0May 22, 2024--Added screenshot for all steps. Updated config.properties
v2.3.0May 17, 20244.21.0CDP 125Updated CDP Network in WebUI
v2.0.0Sep 27, 20234.13.0-Added javadoc for all WebUI keyword functions
v1.9.4May 25, 20234.9.1-Added DataFaker library. Added retry failed test via IAnnotationTransformer. Added CMS test cases. Fixed headless mode
v1.9.3Jan 28, 20234.8.0CDP v109Fixed Allure Report screenshot attachment with TestNG > 7.4.0. Added AllureListener implementing TestLifecycleListener
v1.9.0Nov 8, 20224.6.0-Introduced Selenium Manager for auto-download of browser binaries. Removed WebDriverManager from BrowserFactory. Updated Selenium Grid config
v1.8.0Sep 19, 2022--Added Telegram Bot integration via TelegramManager. Added dragAndDropHTML5() in WebUI. Added verifyDownloadFile()
v1.7.0Aug 11, 20224.4.0-Changed to Page Object Model pattern. Removed object properties files in favor of class-based locators
v1.6.0Jul 25, 20224.3.0-Added complete verify functions in WebUI. Removed IE browser support. Added smartWait, video recording, zip folder config
v1.4.0May 18, 2022--Added LanguageUtils class. Added SCREENSHOT_ALL_STEPS config. Added Authentication using Selenium 4. Added QR Code handling
v1.3.0May 9, 20224.1.4-Added LocalStorageUtils. Added window/tab handling, screenshotElement(), printPage() in WebUI
v1.0.0Apr 5, 2022--Initial release with parallel test execution, Extent/Allure reports, email notifications, video recording, Excel data reading

Current Technical Stack (v2.6.5)

Core Dependencies:

  • Selenium WebDriver: 4.37.0 with CDP 141 for Chromium browsers
  • TestNG: 7.11.0 for test orchestration
  • Maven Surefire Plugin: 3.5.3 for test execution
  • Java Compiler: 17+ with UTF-8 source encoding

Reporting Libraries:

  • ExtentReports: 5.1.2 for HTML/PDF reports
  • Allure TestNG: 2.29.1 with Allure Maven Plugin 2.15.2
  • Allure Plugin API: 2.34.1

Data Processing:

  • Apache POI: 5.4.1 for Excel (.xlsx) file handling
  • Jackson: 2.19.2 for JSON parsing
  • DataFaker: 2.4.4 for synthetic test data generation

Communication:

  • Java Telegram Bot API: 8.3.0 for Telegram notifications
  • JavaMail: 1.6.2 for SMTP email reports

Utilities:

  • Log4j2: 2.24.3 for logging framework
  • Commons IO: 2.19.0 for file operations
  • ZT-Zip: 1.17 for compression utilities
  • Monte Screen Recorder: 0.7.7.0 for video capture
  • MySQL Connector: 9.3.0 and 8.0.33 for database testing

Build Configuration:

  • Maven Compiler Plugin: 3.13.0 targeting Java 17
  • Aspectj Weaver: 1.9.24 for Allure bytecode instrumentation
  • Maven Javadoc Plugin: 3.6.3 for documentation generation

Sources: CHANGELOG.txt1-345 pom.xml23-70 pom.xml72-296 README.md31-32

Framework Entry Points

The framework provides multiple entry points for different use cases and execution scenarios:

Maven Execution

TestNG Suite Configuration

Configuration Management

Sources: README.md48-55 src/test/resources/suites/ structure from README