How midhunnand1313/obsqura_automation works
Project Type and Purpose
• This is a Selenium-TestNG automation framework repository (“Obsqura_Automation”) composed of three Maven sub-projects:
• 7Rmart – a full Page-Object-Model (POM) framework for automating an admin-portal web application
• AutomationJava – a collection of standalone Selenium/Java practice scripts
• TestNGprojects – another TestNG-based sample automation suite
• Each uses Maven for build/dependency management, TestNG for orchestration, Selenium WebDriver to drive browsers, and utilities for cross-cutting concerns (reports, waits, data handling).
File Structure & Architectural Insights
• 7Rmart (the most complete POM example) has:
– src/main/java/constants – global strings/URLs/etc.
– src/main/java/pages – one class per page, encapsulating locators and actions (POM)
– src/main/java/utilities – helpers (Excel reading, waits, file uploads, report extensions)
– src/main/resources/config.properties + TestData.xlsx – externalized configuration and test data
– src/test/java/baseConfiguration – WebDriver setup/teardown (Base class)
– src/test/java/dataProvider – TestNG @DataProvider implementations
– src/test/java/listeners – TestNG Listeners & RetryAnalyzer for screenshots, re-runs, report hooks
– src/test/java/testScipt – TestNG test classes invoking page methods
– testng XMLs for defining suites (cross-browser, grouping, retry)
– extent-reports + test-output folders – generated HTML reports
• AutomationJava & TestNGprojects share a similar TestNG-only pattern (no POM, only scripts under testScript).
Key Components
a. Build & Dependency Layer
– Maven (pom.xml) resolves dependencies (Selenium, TestNG, ExtentReports) and executes tests.
b. Test Runner
– TestNG invokes test classes per testng.xml, driving parallelism, groups, retries.
c. Test Code
– TestNG @Test classes (src/test/java/testScipt, testScript2) implement high-level scenarios.
d. Page Object Layer (for 7Rmart)
– Page classes encapsulate page elements + actions, serving as a façade to WebDriver.
e. Utilities
– ExcelUtility, WaitUtility, FileUploadUtility, ExtendReportUtility, RandomDataUtility.
f. Configuration & Test Data
– config.properties, TestData.xlsx.
g. WebDriver & Browser Instances
– ChromeDriver, EdgeDriver, etc., instantiated in Base class.
h. AUT (Application Under Test)
– The web application endpoints under test (e.g., 7Rmart admin portal).
i. Reporting & Listeners
– TestNG Listeners capture events (onTestFailure to take screenshots), plug into ExtentReports; TestNG default reports.
Relationships & Interactions
• Maven → triggers → TestNG Runner
• TestNG → loads → testng-XML suites → executes → Test Classes
• Test Classes → instantiate/use → Base class → WebDriver → browsers
• Test Classes → call → Page Objects → WebDriver calls (findElement, click, type)
• Page Objects / Test Classes → leverage → Utilities (waits, data, screenshots)
• DataProviders → pull → TestData.xlsx / config.properties
• Listeners → intercept → Test events → log to → ExtentReports + produce → test-output HTML/XML
• Browsers ↔ communicate ↔ AUT (over HTTP)
Architectural Patterns & Principles
• Page Object Model (separation of locators and tests)
• Data Provider pattern (TestNG @DataProvider for data-driven testing)
• Utility classes for cross-cutting concerns (Single Responsibility)
• Listener interceptors (Observer/AOP for logging, screenshots, retries)
• Maven’s declarative build (Convention over Configuration)