Test Automation Design Patterns

Page Object Model (POM)

When? Testing web applications. Why? It abstracts the web pages and their elements into separate classes and separate test logic, making the test code more readable and maintainable.

Facade Pattern and Chain of Invocation

When?

Factory Pattern

What? A creational design pattern that provides an interface for creating objects in a super factory method but allows subclasses to alter the type of objects that will be created

Why? Abstraction and Extensibility.

When:

BDD (Behaviour-Driven development)

What? The requirements of a system and tests are expressed and designed in a way that is accessible to both technical and non-technical team members using Gherkin language syntax.

Why?

KDT (Keyword-Driven testing)

What? Separates the test design and execution phases
Why? Separation / Non-Technical Testers / High-Level Test Design / Cross-Platform

Test Automation Design Patterns

DDT (Data-Driven testing)

What? Test cases are executed multiple times with different sets of input data

When?

Test Automation Design Patterns

Fluent Pattern

What? A method chaining technique used to create more readable and expressive code by allowing calls to methods to be chained together

Why?

Singleton Pattern

What? A creational design pattern that ensures a class has only one instance and provides a global point of access to that instance.

Why?

Decorator Pattern

What? A structural design pattern that allows you to add new behaviors or functionalities to objects dynamically without altering their existing structure

Why? Open for Extension, Closed for Modification ( a Clean code principle) / Reusable Components / Separation of Concerns by isolating additional functionalities in decorator classes / Customization

Wrapper (Adapter) Pattern

What? A design pattern used to enable the interaction between two incompatible interfaces or classes.

When?