Skip to content

mushraf9786/Automation-Testing-Framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Selenium WebDriver Automation Framework

Java Selenium TestNG Maven License

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.


📖 About This Project

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.

🚀 Tech Stack & Features

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.properties file 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.

📦 Project Structure

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

🛠️ Setup & Installation

Prerequisites

  • JDK 17 or higher
  • Apache Maven 3.6.3 or higher
  • An IDE (IntelliJ IDEA recommended)
  • Git

Steps to Run

  1. Clone the repository:

    git clone https://github.com/mushraf9786/Automation-Testing-Framework.git
    cd Automation-Testing-Framework
  2. Import as a Maven Project: Open the project in your IDE. It will automatically detect the pom.xml and download all dependencies.

  3. Run the tests:

    • From the IDE: Right-click on the test class (LoginPageTest.java) and select Run.
    • From the command line:
      mvn clean test

▶️ How to Execute Tests

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

📊 Test Reports

After test execution, TestNG automatically generates a detailed report.

  • The report is located in the test-output directory.
  • Open index.html in your web browser to view the results, including pass/fail status, execution times, and grouped methods.

TestNG Report

📝 Key Learnings & Reflections

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 WebDriverWait and ExpectedConditions to handle dynamic elements, making tests more reliable than using Thread.sleep().
  • Maven Simplifies Everything: Managing dependencies through pom.xml is 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.

🔮 Future Enhancements

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.

🤝 Contributing & Feedback

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.

📜 License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A robust and scalable Selenium WebDriver test automation framework built with Java, TestNG, and Maven. Designed for reliability and ease of maintenance, featuring the Page Object Model (POM), data-driven testing, and comprehensive reporting.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages