# thangarajtk/appium-mobileautomationframework architecture

> Architecture diagram of the GitHub repository thangarajtk/appium-mobileautomationframework, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thangarajtk/appium-mobileautomationframework
- Repository: https://github.com/thangarajtk/appium-mobileautomationframework

## Overview

##### Project type and purpose
- This is a Java-based Appium Mobile Automation Framework for testing native apps and mobile browsers on Android and iOS.
- It leverages TestNG, Page Object Model, custom annotations, parallel execution, and supports video/screenshot capture.

##### File structure
- Top-level: pom.xml, checkstyles, resource files, testng XMLs.
- src/main/java/com/automate:
- constants, enums, customexceptions, customannotations – core metadata and error handling
- driver (factory + manager) – AppiumDriver instantiation, platform/device management
- entity – POJOs for test data
- factories, utils (configloader, dataprovider, screenshot, screenrecording) – support services
- listeners, reports – TestNG listeners and ExtentReports integration
- pages & pages/screen – Page Object Model classes and generic screen actions
- src/test – TestNG test classes and resources: config.json/properties, Excel data, APK, drivers, testng.xml profiles.

##### Key architectural insights from README
- Page Object Model design
- Ability to start/stop Appium server programmatically (AppiumServiceBuilder)
- Parallel test execution on emulators and real devices
- Configurable logging, screenshot & video capture
- Data-driven tests via Excel
- Retry logic and custom annotations for metadata

a. Main components
1. Test Runner Layer
- TestNG & TestNG XMLs (parallel/sequential execution)
2. Framework Core
- Config Loader (PropertyUtils / JsonUtils)
- Driver Manager & Factory
- Appium Server Manager (AppiumServiceBuilder & AppiumDriverLocalService)
- Custom Annotations & Listeners (retry, transform, logger hooks)
3. Page Object Layer
- Page classes (LoginPage, GoogleSearchPage, etc.)
- ScreenActions base class
4. Utilities & Services
- DataProviderUtils / ExcelUtils
- ScreenshotService & Utils
- ScreenRecordingService & Utils
- DecodeUtils, TestUtils
5. Reporting
- ExtentReportManager & ExtentReportLogger
6. External / Infrastructure
- Appium Server (local or sauce labs)
- Mobile Device (Emulator or Real Device)
- Android SDK / iOS dependencies
- Test Data Storage (Excel file, config.json, config.properties)

b. Relationships & interactions
- Test Runner reads TestNG XML → invokes tests in BaseTest
- BaseTest → loads config via Config Loader → instructs Appium Server Manager to start server
- Driver Manager uses Driver Factory → creates AppiumDriver (AndroidDriver / IOSDriver) → connects to Appium Server
- Tests call Page Objects → Page Objects use driver to execute UI actions on device
- Utilities (DataProvider) supply test data from Excel/JSON → Tests
- Listeners capture test events → invoke ScreenshotService & ScreenRecordingService → store artifacts
- Reporting hooks in Listeners → push results to ExtentReportManager → generate HTML reports
- After suite/test → Appium Server Manager stops the server

c. Architectural patterns & principles
- Layered architecture: separation of concerns (Test Runner / Framework Core / Page Objects / Utilities)
- Factory pattern: DriverFactory & WaitFactory
- Singleton pattern: DriverManager, ConfigLoaders
- Observer pattern: Listeners for TestNG events
- Page Object Model: encapsulate page behaviors
- Dependency injection via factories and utilities

d. Key technologies & frameworks
- Java 8, Maven, TestNG
- Appium Java client, Selenium
- ExtentReports for reporting
- Apache POI for Excel
- JSON / Properties for configuration

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Test Runner Layer
    subgraph "Test Runner Layer"
        xml1["testng_android_Emulator.xml"]:::test
        xml2["testng_android_ParallelExecution.xml"]:::test
        xml3["testng_android_RealDevice.xml"]:::test
        tests["Test Classes\n(src/test/java/com/tests)"]:::test
        baseTest["BaseTest"]:::test
    end

    %% Framework Core
    subgraph "Framework Core"
        subgraph "Config Loaders"
            jsonUtils["JsonUtils"]:::core
            propUtils["PropertyUtils"]:::core
        end
        subgraph "Driver & Server Management"
            driverFactory["DriverFactory"]:::core
            driverManager["DriverManager"]:::core
            deviceManager["DeviceManager"]:::core
            platformManager["PlatformManager"]:::core
            serverManager["AppiumServerManager"]:::core
        end
        subgraph "Annotations & Listeners"
            annotation["FrameworkAnnotation"]:::core
            transformer["AnnotationTransformer"]:::core
            retry["Retry"]:::core
            listeners["Listeners"]:::core
        end
    end

    %% Page Object Layer
    subgraph "Page Object Layer"
        pages["Pages\n(src/main/java/com/automate/pages)"]:::pages
        screenActions["ScreenActions"]:::pages
    end

    %% Utilities & Services
    subgraph "Utilities & Services"
        dataProv["DataProviderUtils"]:::utils
        excel["ExcelUtils"]:::utils
        screenshotSvc["ScreenshotService"]:::utils
        screenshotUtil["ScreenshotUtils"]:::utils
        recordingSvc["ScreenRecordingService"]:::utils
        recordingUtil["ScreenRecordingUtils"]:::utils
        decode["DecodeUtils"]:::utils
        testUtils["TestUtils"]:::utils
    end

    %% Reporting
    subgraph "Reporting"
        reportMgr["ExtentReportManager"]:::report
        reportLog["ExtentReportLogger"]:::report
    end

    %% Infrastructure
    subgraph "Infrastructure"
        excelFile["Excel File"]:::infra
        jsonFile["config.json / .properties"]:::infra
        appiumServer["Appium Server"]:::infra
        device["Mobile Device\n(Emulator/Real)"]:::infra
    end

    %% Connections
    xml1 --> baseTest
    xml2 --> baseTest
    xml3 --> baseTest
    tests --> baseTest

    baseTest --> jsonUtils
    baseTest --> propUtils
    baseTest --> serverManager
    baseTest --> driverManager

    serverManager --> appiumServer
    driverManager --> driverFactory
    driverManager --> deviceManager
    driverManager --> platformManager
    driverFactory --> appiumServer

    baseTest --> pages
    pages --> screenActions
    pages --> driverManager

    tests --> dataProv
    dataProv --> excel
    excel --> excelFile
    dataProv --> jsonFile

    listeners --> screenshotSvc
    listeners --> screenshotUtil
    listeners --> recordingSvc
    listeners --> recordingUtil
    listeners --> reportMgr
    listeners --> reportLog

    screenshotSvc --> device
    recordingSvc --> device

    %% Click Events
    click xml1 "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/testng_android_Emulator.xml"
    click xml2 "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/testng_android_ParallelExecution.xml"
    click xml3 "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/testng_android_RealDevice.xml"
    click tests "https://github.com/thangarajtk/appium-mobileautomationframework/tree/master/src/test/java/com/tests"
    click baseTest "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/test/java/base/BaseTest.java"
    click jsonUtils "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/utils/configloader/JsonUtils.java"
    click propUtils "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/utils/configloader/PropertyUtils.java"
    click driverFactory "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/driver/factory/DriverFactory.java"
    click driverManager "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/driver/manager/DriverManager.java"
    click deviceManager "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/driver/manager/DeviceManager.java"
    click platformManager "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/driver/manager/PlatformManager.java"
    click serverManager "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/utils/AppiumServerManager.java"
    click annotation "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/customannotations/FrameworkAnnotation.java"
    click transformer "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/listeners/AnnotationTransformer.java"
    click retry "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/listeners/Retry.java"
    click listeners "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/listeners/Listeners.java"
    click pages "https://github.com/thangarajtk/appium-mobileautomationframework/tree/master/src/main/java/com/automate/pages"
    click screenActions "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/pages/screen/ScreenActions.java"
    click dataProv "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/utils/dataprovider/DataProviderUtils.java"
    click excel "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/utils/dataprovider/ExcelUtils.java"
    click screenshotSvc "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/utils/screenshot/ScreenshotService.java"
    click screenshotUtil "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/utils/screenshot/ScreenshotUtils.java"
    click recordingSvc "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/utils/screenrecording/ScreenRecordingService.java"
    click recordingUtil "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/utils/screenrecording/ScreenRecordingUtils.java"
    click decode "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/utils/DecodeUtils.java"
    click testUtils "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/utils/TestUtils.java"
    click reportMgr "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/reports/ExtentReportManager.java"
    click reportLog "https://github.com/thangarajtk/appium-mobileautomationframework/blob/master/src/main/java/com/automate/reports/ExtentReportLogger.java"

    %% Styles
    classDef test fill:#D5B8FF,stroke:#888
    classDef core fill:#B3CDE3,stroke:#888
    classDef pages fill:#C6E2A9,stroke:#888
    classDef utils fill:#FDD0A2,stroke:#888
    classDef report fill:#F4B4C4,stroke:#888
    classDef infra fill:#CCCCCC,stroke:#888
```
