This project is an end-to-end automation suite for a Hospital Management System (HMS). The primary goal is to validate critical business workflows including user authentication, security protocols, and the management of blood bank data.
The framework is built using the Page Object Model (POM) design pattern, which separates the application's UI locators from the test scripts to ensure the code is modular and easy to maintain.
The project follows a standard Maven directory structure for organized development:
- TestBase.java: The heart of the framework. It handles the browser setup (Chrome in Incognito mode), sets global timeouts (Implicit Waits), and configures Log4j2 for auditing.
- LoginPage.java: Contains private
Bylocators and methods for login interactions and credential validation. - HomePage.java: Manages global navigation, including the mouse-hover actions for the Blood Bank menus and the Logout functionality.
- BloodBankPage.java: Handles all three sub-modules: Add, View, and Update Blood Bank details.
- LoginTest.java: Executes test cases for valid/invalid logins and mandatory field checks.
- BloodBankTest.java: Includes data-driven tests for adding records and verifying numeric constraints for Donor IDs and Contact Numbers.
- LogoutTest.java: Validates critical security requirements like session clearing and browser back-button restrictions.
- Initialization:
TestBasestarts the Chrome driver usingChromeOptionsfor an incognito session. - Setup: The Test class (e.g.,
LoginTest) initializes the required Page Objects, passing thedriverinstance to them via constructors. - Action: The test script calls high-level methods from the Page classes (e.g.,
loginPage.login("user", "pass")). - Validation: TestNG assertions compare actual results (like URLs or error messages) against the expected results defined in the SRS.
- Logging: Throughout the process, Log4j2 records every step into
app.logfor a complete audit trail. - Teardown: The
@AfterMethodinTestBasecloses the browser session to release resources.
This framework ensures 100% coverage of the following requirements:
- Requirement 1 (Login): Mandatory field validation and password masking.
- Requirement 2 (Logout): Redirection to login page and disabling back-button access.
- Requirement 3 (Add Bank): Constraints of 0-10 digits for Donor ID and exactly 10 digits for Contact No.
- Requirement 4 (View/Update): AJAX auto-suggest dropdown handling and operational status updates.
- Install JDK 11+ and Eclipse IDE.
- Install the TestNG plugin for Eclipse.
- Import this project as an Existing Maven Project.
- Update the
chromedriver.exepath inTestBase.java. - Right-click
testng.xmland select Run As > TestNG Suite.