How testingtequila/janbaskdemoautomation works
Purpose and Execution Model
This is a Java/Maven UI automation project for the Janbask demo e-commerce site. It executes Cucumber BDD scenarios through TestNG, driving a real browser with Selenium WebDriver. Maven is the build, dependency, and test-launch boundary: pom.xml.
BDD Specification Layer
Gherkin features define user-visible behavior and scenario inputs. The current functional scope is login behavior:
• src/test/resources/features/Login.feature
Cucumber binds these steps to Java implementation classes rather than directly to browser code.
Test Orchestration
The TestNG/Cucumber runner discovers feature files and step-definition glue, configures Cucumber plugins/reporting, and initiates scenario execution:
• src/test/java/testRunner/TestRunner.java
Scenario lifecycle setup/teardown is centralized in hooks, providing the control boundary for browser initialization and cleanup:
• src/test/java/stepDefinitions/Hooks.java
Step-Definition Layer
Step definitions translate Gherkin actions/assertions into calls on page objects. They should remain workflow-oriented and avoid Selenium locator details:
• src/test/java/stepDefinitions/Login.java
Control flow is: Login.feature → Cucumber runner → hooks → Login steps → page objects/utilities → Selenium browser session.
Page Object Model
Page objects encapsulate site pages, locators, and high-level UI actions. The present model covers authentication, account state, and store interactions:
• src/main/java/pom/AccountLogin.java
• src/main/java/pom/MyAccount.java
• src/main/java/pom/MyStore.java
This is the primary maintainability boundary: feature and step code should depend on page actions, while Selenium-specific interactions remain in these page abstractions and shared utilities.
Browser and Shared Automation Services
Browser selection/session handling is centralized rather than embedded in individual scenarios:
• src/main/java/utilities/HandlingBrowsers.java
Shared reusable behavior, likely including waits or common WebDriver interactions, is grouped in:
• src/main/java/utilities/Reuse.java
The runtime depends on Java, Maven, Selenium WebDriver, Cucumber, and TestNG. The external system under test is janbaskdemo.com; browser-driver availability/configuration is an environmental dependency.
Test Data and State
Data classes isolate named test inputs or application-level values from scenario and page logic:
• src/main/java/datarepo/AppLevel.java
• src/main/java/datarepo/TCLevelData.java
These classes form the intended data boundary for reusable application-wide versus test-case-specific values, reducing hard-coded credentials or inputs in step definitions.
Reporting and Outputs
Cucumber plugin configuration in the runner/build produces feature-level execution results, conventionally under Maven’s target output. No CI pipeline, dedicated configuration files, or externally hosted reporting integration is present in the supplied tree.
Main entry points: Login.java Login steps · TestRunner.java Cucumber TestNG runner · Reuse.java Shared automation · pom.xml Maven build
Components 15
BDD Specification
- Login feature
src/test/resources/features/Login.feature - Login steps · Translates login scenarios into page actions.
src/test/java/stepDefinitions/Login.java
Test Execution
- Maven build · Resolves dependencies and launches the test suite.
pom.xml - Cucumber TestNG runner · Discovers features and glue and configures reporting.
src/test/java/testRunner/TestRunner.java - Scenario hooks · Creates and cleans up browser sessions per scenario.
src/test/java/stepDefinitions/Hooks.java - Test results · Cucumber plugin output is written under target.
Automation Core
- Account login page
src/main/java/pom/AccountLogin.java - My account page
src/main/java/pom/MyAccount.java - Store page
src/main/java/pom/MyStore.java - Browser handling · Centralizes browser selection and WebDriver session creation.
src/main/java/utilities/HandlingBrowsers.java - Shared automation · Provides reusable waits and browser interactions.
src/main/java/utilities/Reuse.java
Test Data
- Application data · Holds reusable application-level values.
src/main/java/datarepo/AppLevel.java - Test-case data · Holds test-case-specific inputs.
src/main/java/datarepo/TCLevelData.java
Other components
- Browser driver · A locally available browser and driver execute WebDriver commands.
- Janbask demo site
Connections 18
- Maven build → Cucumber TestNG runner: launches
- Maven build → Test results: writes output
- Login feature → Cucumber TestNG runner: discovered by
- Cucumber TestNG runner → Scenario hooks: runs lifecycle
- Cucumber TestNG runner → Login steps: binds steps
- Cucumber TestNG runner → Test results: publishes results
- Scenario hooks → Browser handling: initializes and closes
- Login steps → Account login page: uses
- Login steps → My account page: uses
- Login steps → Store page: uses
- Login steps → Application data: reads values
- Login steps → Test-case data: reads inputs
- Browser handling → Browser driver: creates session
- Account login page → Shared automation: uses shared actions
- My account page → Shared automation: uses shared actions
- Store page → Shared automation: uses shared actions
- Shared automation → Browser driver: issues WebDriver commands
- Browser driver → Janbask demo site: drives UI against