Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/avdhutssh/designpatterns-java-selenium
Design Patterns Following SOLID Principle
https://github.com/avdhutssh/designpatterns-java-selenium
java selenium test-automation
Last synced: 3 months ago
JSON representation
Design Patterns Following SOLID Principle
- Host: GitHub
- URL: https://github.com/avdhutssh/designpatterns-java-selenium
- Owner: avdhutssh
- Created: 2024-08-12T07:43:57.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-25T08:53:34.000Z (4 months ago)
- Last Synced: 2024-10-11T18:22:17.879Z (3 months ago)
- Topics: java, selenium, test-automation
- Language: Java
- Homepage:
- Size: 88.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
---
# π¨ Design Patterns in JAVA with Selenium
## π Table of Contents
- [Introduction](#introduction)
- [Design Patterns Implemented](#DesignPatternsImplemented)
- [Project Structure](#project-structure)
- [Getting Started](#getting-started)
- [Running Examples](#running-tests)
- [Contributions](#contributions)
- [Contacts](#contacts)## π Introduction
This repository demonstrates various design patterns applied in Selenium WebDriver with Java, aimed at creating a robust and maintainable automation framework. The concepts are based on a structured course, covering good code practices and the implementation of design patterns like Factory, Strategy, Command, Template Method, Proxy, and Decorator.
## π¨ Design Patterns Implemented
- **Single Responsibility Principle:** Ensures that each class has only one reason to change by focusing on a single responsibility. This pattern is essential in test automation to keep the code clean and maintainable.
- **Factory Pattern:** This pattern is used to create objects without specifying the exact class of the object that will be created. In test automation, it helps in managing different browser instances or page objects based on specific test requirements.
- **Strategy Pattern:** The strategy pattern allows defining a family of algorithms, encapsulating each one, and making them interchangeable. In automation, it is useful for switching between different testing strategies or browser configurations without altering the core framework.
- **Command Pattern:** Encapsulates a request as an object, allowing for parameterization of clients with queues, requests, and operations. In test automation, it's used to encapsulate different actions (like click, type, etc.) that can be executed in a flexible manner.
- **Template Method Pattern:** This pattern defines the skeleton of an algorithm in a method, deferring some steps to subclasses. It is widely used in test automation to define a workflow of tests where the steps can be overridden as needed.
- **Proxy Pattern:** The proxy pattern provides a surrogate or placeholder for another object to control access to it. In automation, it can be used to manage browser sessions or network interactions, providing controlled access and adding layers like logging or validation.
- **Execute Around Method Pattern:** This pattern is used to abstract away repetitive tasks or setup/cleanup code that needs to be executed around the main logic. In test automation, itβs particularly useful for ensuring certain conditions are met before and after executing a test step, such as opening and closing a browser or handling authentication.
- **Decorator Pattern:** This pattern allows behavior to be added to individual objects, either statically or dynamically, without affecting the behavior of other objects from the same class. It's particularly useful in test automation for adding additional functionalities like logging, taking screenshots, or handling waits without changing the core logic of page objects or components.
## π Project Structure
```plaintext
Pattern/
βββββββsrc/main/java
β β β β βββ PageObjects and Wrapper Classes/ # Page Object classes and wrapper classes
Pattern/
βββββββsrc/main/test
β β β β βββ Base Test and Main Test # Test classes
```## βΆοΈ Getting Started
### Prerequisites
- Java JDK 8 or higher
- Maven
- WebDriver binaries and dependencies in pom.xml
- IDE (e.g., IntelliJ IDEA, Eclipse)### Installation
1. Clone the repository:
```bash
git clone https://github.com/avdhutssh/DesignPatterns-Selenium
cd DesignPatterns-Selenium
```2. Install dependencies:
```bash
mvn clean install
```## π Running Examples
You can run the tests under test packages using the following Maven command:
```bash
mvn test
```## π‘ Contributions
Contributions are welcome! Please fork the repository and submit a pull request to propose changes.
## π§ Contacts
- [![Email](https://img.shields.io/badge/[email protected])](mailto:[email protected])
- [![LinkedIn](https://img.shields.io/badge/LinkedIn-Profile-blue)](https://www.linkedin.com/in/avdhut-shirgaonkar-811243136/)Feel free to reach out if you have any questions or suggestions.
Happy Learning!!!