How rupamdas-lt/ltqa-cbt-selenium works
Project Type and Purpose
• This is a test-automation framework (LTQA Selenium Automation Framework) built in Java.
• It uses Cucumber for BDD, TestNG as the test runner, Selenium WebDriver for browser automation, and integrates with external services (LambdaTest grid, ReportPortal, Sumo Logic, tunnel service).
• Its purpose is to define, execute, and report cross-browser, cross-platform UI tests (and some API verifications) in a reusable, configurable way.
File-Structure Analysis
• Top-level:
• pom.xml (Maven build, dependencies, plugins)
• README.md (framework setup and usage)
• Utility/Bash (scripts for tunnel setup, cleanup, hosts entry)
• testng.xml / testng-rerun.xml (TestNG suite definitions)
• Source code (src/main/java):
• DTOs: data-transfer objects for API responses (Swagger, tunnels, test details).
• Pages: Page-Object classes for each UI page or log view.
• Hooks: Cucumber hooks (setup/teardown).
• TestManagers: orchestrators (DriverManager, CapabilityManager, ApiManager, TunnelManager).
• automationHelper: high-level helpers & ReportPortal/Sumo integration.
• factory: BrowserType, Locator, LocatorTypes (Factory pattern for driver and locator).
• utility: shared helpers (BaseClass, EnvSetup, FrameworkConstants, FileLock, ScenarioUtils).
• Test code (src/test):
• features: Cucumber feature files organized by suite (OS regressions, Benchmarking, Tunnel).
• stepDefinitions: glue code mapping Gherkin to Java.
• listeners: TestNG/Cucumber event listeners.
• test resources: cucumber.yaml template, JSON test-data, JSON schemas, sample files.
README Insights
• Describes CLI flags (ENV, PARALLEL, CUSTOM_USER_*, Sumo flags) – those represent configuration & environment layer.
• Tunnel setup and host overrides – external helper scripts.
• Video verification via ffmpeg – optional post-processing.
Components
a. Core Layers
1. Test Definition Layer
• Cucumber .feature files
• TestNG Runner (TestRunner, FailedTestRunner)
2. Glue Layer
• stepDefinitions (AutomationSetupDefinitions)
• Hooks (Hooks.java)
3. Domain-Logic Layer
• TestManagers (DriverManager, CapabilityManager, TunnelManager, ApiManager)
• factory (BrowserType, Locator)
4. Page-Object Layer
• Pages (LoginPage, TestConsoleLogsPage, etc.)
5. Helper & Utility Layer
• automationHelper (AutomationAPIHelper, LTHooks, TestArtefactsVerificationHelper)
• utility (EnvSetup, ScenarioUtils, FileLockUtility)
6. Data & Config Layer
• DTOs (SwaggerAPIs, Others)
• JSON test data & schemas
• cucumber.yaml, log4j2.yaml, reportportal.properties
7. External Services
• Selenium Grid (LambdaTest)
• Tunnel Service (binary & Utility/Bash scripts)
• ReportPortal
• Sumo Logic
• ffmpeg (video verification)
b. Relationships & Data Flow
1. User invokes mvn test with flags → TestNG Runner
2. Runner loads feature files → Cucumber engine → Hooks & stepDefinitions
3. stepDefinitions call TestManagers to:
• configure capabilities → CapabilityManager
• spin up tunnel if needed → TunnelManager + Utility/Bash
• instantiate WebDriver → DriverManager → connects to remote grid
4. Business flows use Page-Object methods → Browser interaction → Grid returns results
5. For API validations: ApiManager calls REST endpoints → DTOs deserialize responses
6. automationHelper verifies artefacts (videos, logs), pushes results → ReportPortal/Sumo Logic
7. test data & config loaded from resources at each stage
Architectural Patterns & Design Principles
• Page-Object Model for UI abstraction.
• Factory pattern to instantiate browsers and locators.
• Singleton or Thread-Local for Manager classes to ensure per-thread isolation in parallel runs.
• Layered architecture separating test definitions, orchestration, domain logic, and utilities.
• BDD pattern with Cucumber.
Detailed Elements
• Blocks for each major manager and package group.
• Annotations for Maven CLI flags influencing flow (e.g., ENV, PARALLEL).
• Connection from Utility/Bash scripts to TunnelManager.
• Optional ffmpeg integration.