A robust and scalable test automation framework built with Selenium WebDriver and Java. This project serves as my hands-on learning environment for implementing industry-standard best practices in UI automation, focusing on maintainability, reusability, and reliability.
Note: 🎓 This is a learning and portfolio project. The tests are run against public demo sites (like the nopCommerce demo) and the codebase will continuously evolve as I explore new concepts and tools.
This framework is a practical implementation of key test automation concepts. The primary goals are to:
- Solidify Core Skills: Master Selenium WebDriver fundamentals for browser automation.
- Implement Design Patterns: Use the Page Object Model (POM) to create clean, maintainable, and reusable code.
- Manage Dependencies: Efficiently handle project dependencies and builds with Apache Maven.
- Structure Tests: Leverage the TestNG framework for powerful test organization, assertions, and parallel execution.
- Handle Real-World Scenarios: Implement robust solutions for dynamic web elements, synchronization issues, and cross-browser testing.
- Integrate Tools: Incorporate logging and reporting to build a professional-grade automation suite.
| Category | Technology |
|---|---|
| Language | Java 17 |
| Browser Automation | Selenium WebDriver 4 |
| Testing Framework | TestNG |
| Build Tool | Apache Maven |
| Design Pattern | Page Object Model (POM) |
| Element Locators | ID, XPath, CSS Selectors |
| Synchronization | Explicit Waits (WebDriverWait) |
| Driver Management | Selenium Manager (Automatic) |
| Logging | SLF4J |
Key Features:
- Page Object Model Design: All page-specific logic is encapsulated in separate classes.
- Data-Driven Ready: Structure is in place to easily parameterize tests with external data.
- Configurable: Uses a
config.propertiesfile for environment-specific settings (e.g., URL, browser). - Detailed Reporting: TestNG generates detailed HTML reports after each run.
- Best Practices: Avoids
Thread.sleep()in favor of explicit waits for stable test execution.
src/test/java/ │ ├── Pages/ # Page Object Classes following POM │ ├── LoginPage.java │ └── HomePage.java │ ├── tests/ # TestNG Test Classes │ └── LoginPageTest.java │ ├── utilities/ # Helper/Utility Classes │ └── ConfigReader.java │ └── resources/ ├── config.properties # Configuration file (URL, browser) └── (未来: test data files)
text
- JDK 17 or higher
- Apache Maven 3.6.3 or higher
- An IDE (IntelliJ IDEA recommended)
- Git
-
Clone the repository:
git clone https://github.com/mushraf9786/Automation-Testing-Framework.git cd Automation-Testing-Framework -
Import as a Maven Project: Open the project in your IDE. It will automatically detect the
pom.xmland download all dependencies. -
Run the tests:
- From the IDE: Right-click on the test class (
LoginPageTest.java) and selectRun. - From the command line:
mvn clean test
- From the IDE: Right-click on the test class (
Tests can be executed in several ways:
- Run all tests in the project:
mvn test - Run a specific test class:
mvn test -Dtest=LoginPageTest - Run tests with a specific browser: (Future implementation)
mvn test -Dbrowser=firefox
After test execution, TestNG automatically generates a detailed report.
- The report is located in the
test-outputdirectory. - Open
index.htmlin your web browser to view the results, including pass/fail status, execution times, and grouped methods.
This project is a journey. Here are some of the core concepts I've implemented and understood:
- The Importance of POM: Drastically reduces code duplication and makes test maintenance significantly easier.
- Synchronization is Key: Learned to use
WebDriverWaitandExpectedConditionsto handle dynamic elements, making tests more reliable than usingThread.sleep(). - Maven Simplifies Everything: Managing dependencies through
pom.xmlis efficient and clean. - The Devil's in the Details: A simple missing
.click()action can cause a test to fail, emphasizing the need for careful code review.
As I continue to learn, I plan to integrate the following:
- CI/CD Integration: Set up a pipeline with Jenkins or GitHub Actions.
- Advanced Reporting: Integrate Allure Reports for more detailed and visual test reports.
- Dockerization: Run tests in Docker containers for consistent environments.
- Cross-Browser Testing: Configure parallel execution on Chrome, Firefox, and Edge.
- API Testing: Incorporate RestAssured for hybrid (UI + API) testing workflows.
- BDD: Implement Behavior-Driven Development with Cucumber.
This is a personal learning project. While it's not open for contributions, feedback and suggestions are highly appreciated! If you spot an anti-pattern or have an idea for improvement, please open an issue to discuss it.
This project is licensed under the MIT License. See the LICENSE file for details.
