How surajsingh3091/nextgenerationautomationframework works
Project Type and Purpose
• This is a Java-based test automation framework built with Maven, using Cucumber for BDD, Selenium WebDriver for browser automation, and a Page Object Model (POM) structure.
• Purpose: Drive end-to-end UI tests against an application (e.g., OrangeHRM), manage test configuration, logging, and reporting.
File Structure Analysis
A. src/main/java/application/PageRepository
• PageInitializer – bootstraps page objects
• PageObjectManager – provides centralized access to page instances
• Pages folder – individual POM classes (Login_Page, Home_Page, AddEmployee_Page, ApplicationMaster_Page)
B. src/main/java/com/nextZen/Framework
• Base
– DriverManager.java (initializes and tears down WebDriver)
• ConfigReaderUtility
– ConfigurationManager.java (singleton reads .properties files)
• ExecutionContext
– ExecutionContext.java (holds test-level context, e.g., WebDriver, test name)
• WebUtility
– SeleniumHelper.java (wrapper methods over Selenium commands)
C. src/main/resources
• Properties/DBConfig.properties (database config)
• log4j2.xml (logging config)
D. src/test/java
• StepDefinition
– CommonStepDefinition.java, StepDefinition.java (Cucumber step definitions)
– TestHooks/CucumberHooks.java (before/after hooks)
• TestRunner/TestRunner.java (JUnit runner for Cucumber)
E. src/test/resources
• Feature files (AddEmployee.feature under OrangeHRM folder)
• TestConfig.properties, extent-config.xml (reporting config)
• TestData folder
Key Insights from README
• Minimal information (project title).
• Project name (“NextGenerationAutomationFramework”) confirms it’s a reusable automation framework.
Main Components
1. Test Artifacts
– Feature Files (Gherkin)
– Test Data / Properties
2. Test Engine
– TestRunner (JUnit + Cucumber)
– Cucumber Hooks (setup/teardown)
– Step Definitions
3. Framework Core
– ConfigurationManager (reads config files)
– DriverManager (manages WebDriver instances)
– ExecutionContext (holds per-scenario context)
– SeleniumHelper (higher-level WebDriver utilities)
4. Page Object Layer
– PageInitializer / PageObjectManager
– Page classes (Login_Page, Home_Page, etc.)
5. External Dependencies
– Selenium WebDriver
– Browser (Chrome, Firefox, etc.)
– Logging (log4j2)
– Database (via DBConfig.properties, if used)
6. Build & Reporting
– Maven (pom.xml)
– Extent Reports (extent-config.xml)
Component Relationships and Data Flow
Feature Files → TestRunner → Cucumber Engine → Step Definitions
Step Definitions → (via PageObjectManager) → Page Objects → SeleniumHelper → DriverManager → Browser
ConfigurationManager → provides config to DriverManager & ExecutionContext
ExecutionContext → shared state across hooks, steps, page objects
Test Data & Properties → consumed by ConfigurationManager & Step Definitions
Logs → log4j2 → output
Architectural Patterns and Design Principles
• Page Object Model (POM) – separation of page interaction logic
• Singleton for ConfigurationManager, DriverManager
• Factory/Manager for Page objects (PageObjectManager)
• Context Object for sharing state (ExecutionContext)
• BDD with Cucumber (clear separation of feature, definition, runner)