How ashutoshti/clipboardhealth works
Project Type and Purpose
• This is a hybrid BDD Automation Testing framework built in Java using Cucumber (with Gherkin syntax) along with TestNG/JUnit.
• Its goal is to facilitate behavior-driven development (BDD) testing of web applications on multiple browsers (Chrome and Firefox) using a modular, dynamic Page Object Model (POM) approach.
• The framework is designed so that both technical and non-technical stakeholders (developers, testers, scrum masters, etc.) can view the automation flow and reports.
Analyzing the File Structure
• Top-Level Components:
• “src/main/java” – Contains the core framework classes:
▪ driver package: Includes DriverFactory (handles browser instantiation and configuration) and ConstantVariable (stores fixed configuration values).
▪ pages package: Contains Page Objects such as HomePage and TelevisionPage that encapsulate the UI elements and actions.
▪ Util package: Provides utility functions and configurations via classes like ElementUtil and ConfigReader.
• “src/test/java” – Contains the testing-specific implementations:
▪ parallel package: Hosts the ApplicationHooks (which execute pre-/post-test methods), step definition classes (HomePageSteps, TelevisionSteps) that bind the Gherkin feature files to Java code, and a customReportListener for generating reports.
▪ testrunner package: Contains MyTestRunner, the entry point to trigger the tests.
• “src/test/resources” – Contains supporting resources:
▪ config folder: Contains config.properties for environment-specific variables (like browser name).
▪ Executable_Driver: Holds executable files for browsers (chromedriver.exe, geckodriver.exe).
▪ Features: Contains the Gherkin feature files (“Home.feature“ and “Television.feature”) that describe test scenarios.
Key Components and Their Interactions
a. Driver Management:
• DriverFactory (in driver package) selects and initializes the correct browser driver based on configurations done via ConfigReader (from Util).
• This module ensures that the browsers (Chrome, Firefox) are properly set up with necessary properties (like maximizing the window) before tests run.
b. Page Object Layer:
• Each page (HomePage, TelevisionPage) encapsulates the web elements and actions. This isolates the UI logic from the test scripts.
c. Utility Layer:
• The ElementUtil class and methods are used across pages and steps for common interactions (clicks, typing, waits, etc.).
d. Test Execution:
• The Test Runner (MyTestRunner) triggers scenarios written in Gherkin (“Features” folder).
• ApplicationHooks (from the parallel package) initialize preconditions (e.g., setting up drivers) before executing step definitions.
• Step definition classes (HomePageSteps, TelevisionSteps) map Gherkin steps to methods in the page objects.
• Upon execution, a customReportListener generates Cucumber test reports displayed in the console.
Architectural Patterns and Design Principles
• The Page Object Model (POM) is clearly used for encapsulating UI interactions.
• Separation of Concerns (SoC) is applied by segregating driver configuration, page interactions, utilities, and test execution.
• BDD principles drive the structure by linking human-readable Gherkin scenarios with the underlying automation code.
• Modular design: Each package (driver, pages, Util, test/parallel, testrunner, and resources) has a well-defined responsibility.