How beeminetid/selenium-java-automation-framework works
Purpose and execution model
This is a Java 17/Maven hybrid automation framework for live e-commerce UI and REST API validation. It targets automationexercise.com, with Selenium-specific capability tests against the-internet.herokuapp.com. Maven profiles and TestNG suite XML select API, UI, BDD, health, hybrid E2E, unit, and capability runs. Primary build/CI entry points: pom.xml, Jenkinsfile, .github/workflows/regression.yml.
Test orchestration boundary
Two test styles share framework services:
• Cucumber scenarios enter through src/test/java/com/qa/framework/runners/CucumberTestNGRunner.java, bind feature steps in src/test/java/com/qa/framework/steps, and own browser lifecycle through src/test/java/com/qa/framework/hooks/Hooks.java.
• Plain TestNG tests derive lifecycle/client setup from src/test/java/com/qa/tests/base/BaseUiTest.java and src/test/java/com/qa/tests/base/BaseApiTest.java.
• Hybrid flows combine the API account lifecycle with UI validation in src/test/java/com/qa/tests/e2e/ApiUiHybridCheckoutTest.java.
Configuration and browser runtime
src/main/java/com/qa/framework/config/ConfigManager.java resolves environment-aware settings, including browser, headless mode, remote Grid URL, primary-site URL, and capability-site URL. src/main/resources/config/qa.properties and src/main/resources/config/staging.properties provide environment baselines.
src/main/java/com/qa/framework/driver/DriverFactory.java creates local or remote Chrome/Firefox/Edge sessions and configures per-thread download directories. src/main/java/com/qa/framework/driver/DriverManager.java holds WebDriver instances in ThreadLocal, enabling TestNG/Cucumber parallel isolation.
UI automation layer
Page objects encapsulate site navigation, locators, and user actions: src/main/java/com/qa/framework/pages/BasePage.java, src/main/java/com/qa/framework/pages/HomePage.java, and src/main/java/com/qa/framework/pages/CheckoutPage.java. BasePage supplies shared synchronization and browser-interaction capabilities; page-specific objects model account, product, cart, checkout, payment, and engagement flows.
Specialized pages isolate non-primary-site DOM patterns: src/main/java/com/qa/framework/pages/capabilities/IframeEditorPage.java, src/main/java/com/qa/framework/pages/capabilities/MultiWindowPage.java, and src/main/java/com/qa/framework/pages/capabilities/ShadowDomPage.java. Critical-element maps in pages feed the state-free locator health check.
API automation layer
src/main/java/com/qa/framework/api/ApiClient.java centralizes the RestAssured request specification. Endpoint clients separate product/brand/search concerns from account lifecycle operations: src/main/java/com/qa/framework/api/endpoints/ProductsApiClient.java and src/main/java/com/qa/framework/api/endpoints/AccountApiClient.java. Typed payload/domain models—such as src/main/java/com/qa/framework/api/models/AccountPayload.java and src/main/java/com/qa/framework/api/models/Product.java—form the boundary between tests and API request/response data.
Data, reliability, and reporting
Test data is externalized under src/test/resources/testdata and supplied centrally by src/test/java/com/qa/tests/data/DataProviders.java; framework readers support CSV and Excel through src/main/java/com/qa/framework/utils/CsvDataReader.java and src/main/java/com/qa/framework/utils/ExcelDataReader.java. Generated account/payment data comes from src/main/java/com/qa/framework/utils/TestDataFactory.java.
Failure handling and observability are listener-driven: src/main/java/com/qa/framework/listeners/RetryTransformer.java, src/main/java/com/qa/framework/listeners/ExtentTestListener.java, and src/main/java/com/qa/framework/report/ExtentManager.java apply retries, collect suite results, and produce Extent HTML reports with failure screenshots.
Infrastructure and external dependencies
Maven resolves Selenium 4, TestNG, Cucumber, RestAssured/Jackson, Apache POI, Extent, Log4j2, and DataFaker. docker-compose.yml provisions Selenium Grid hub plus Chrome/Firefox nodes; remote sessions use the configured Grid endpoint. GitHub Actions executes separated API, health, smoke, and regression jobs, while Jenkins can parameterize suite, browser, headless mode, and Grid usage.
Main entry points: BaseUiTest.java TestNG base tests · DriverFactory.java Driver factory · AccountApiClient.java Endpoint clients · BasePage.java Page object layer
Components 21
Test orchestration
- Cucumber TestNG runner
src/test/java/com/qa/framework/runners/CucumberTestNGRunner.java - Steps and hooks · Binds features and owns browser lifecycle.
src/test/java/com/qa/framework/hooks/Hooks.java - TestNG base tests · Shared UI and API setup for plain TestNG tests.
src/test/java/com/qa/tests/base/BaseUiTest.java - Hybrid checkout test · Combines API account lifecycle with UI checkout validation.
src/test/java/com/qa/tests/e2e/ApiUiHybridCheckoutTest.java
Framework services
- Config manager · Resolves browser, URLs, headless mode, and Grid endpoint.
src/main/java/com/qa/framework/config/ConfigManager.java - Environment baselines
src/main/resources/config/qa.properties - Driver factory · Creates local or Grid browser sessions and download directories.
src/main/java/com/qa/framework/driver/DriverFactory.java - Driver manager · Isolates WebDriver instances for parallel TestNG and Cucumber runs.
src/main/java/com/qa/framework/driver/DriverManager.java
Automation layers
- Page object layer · Shared synchronization plus primary-site navigation and checkout flows.
src/main/java/com/qa/framework/pages/BasePage.java - Capability pages · Encapsulates iframe, multi-window, and Shadow DOM patterns.
src/main/java/com/qa/framework/pages/capabilities/IframeEditorPage.java - API client · Central request specification for API automation.
src/main/java/com/qa/framework/api/ApiClient.java - Endpoint clients · Separates catalog/search from account lifecycle operations.
src/main/java/com/qa/framework/api/endpoints/AccountApiClient.java - API models
src/main/java/com/qa/framework/api/models/AccountPayload.java
Data and reporting
- Test data providers · Supplies externalized CSV and Excel test data.
src/test/java/com/qa/tests/data/DataProviders.java - Test data files
src/test/resources/testdata - Generated test data · Generates account and payment data.
src/main/java/com/qa/framework/utils/TestDataFactory.java - Retries and Extent reports · Retries failures and emits HTML reports with screenshots.
src/main/java/com/qa/framework/listeners/ExtentTestListener.java
Build and infrastructure
- Maven profiles · Selects API, UI, BDD, health, hybrid, unit, and capability suites.
pom.xml - CI pipelines · GitHub runs separated jobs; Jenkins parameterizes suite and browser execution.
.github/workflows/regression.yml - Selenium Grid · Hub with Chrome and Firefox nodes for remote sessions.
docker-compose.yml
Other components
- Target sites · Automation Exercise is primary; the-internet hosts capability tests.
Connections 26
- Cucumber TestNG runner → Steps and hooks: executes
- Steps and hooks → Driver factory: starts browser
- TestNG base tests → Driver factory: sets up browser/client
- Hybrid checkout test → TestNG base tests: uses lifecycle
- Hybrid checkout test → Endpoint clients: creates account
- Hybrid checkout test → Page object layer: validates checkout
- Config manager → Environment baselines: loads
- Driver factory → Config manager: reads settings
- Driver factory → Driver manager: stores session
- Driver factory → Selenium Grid: remote sessions
- Page object layer → Driver manager: uses WebDriver
- Page object layer → Target sites: drives UI
- Capability pages → Page object layer: specializes
- Capability pages → Target sites: tests capabilities
- Endpoint clients → API client: uses
- Endpoint clients → API models: maps payloads
- Endpoint clients → Target sites: calls REST API
- Test data providers → Test data files: reads
- TestNG base tests → Test data providers: consumes
- TestNG base tests → Generated test data: generates data
- Cucumber TestNG runner → Retries and Extent reports: publishes results
- TestNG base tests → Retries and Extent reports: publishes results
- Maven profiles → Cucumber TestNG runner: selects BDD suites
- Maven profiles → TestNG base tests: selects test suites
- CI pipelines → Maven profiles: runs profiles
- CI pipelines → Selenium Grid: can enable Grid