Usage of Design Patterns in Automation

Quarterly Automation Testing Expert Series - Vol 1/4 2021

Timothy Joseph
Timothy Joseph | February 17, 2021

Creational

These patterns provide a variety of object creation mechanisms that enhances
the flexibility and reuse of the existing code.

Architecture of Using Creational Design Patterns

Architecture using Creational Design Patterns

Benefits of Singleton Design Pattern

Benefits of Factory Design Pattern

Saves memory for the creation of multiple objects

Promotes loose coupling among multiple classes

Multiple design options for object creation

Allows child classes to manage the object creation

Handles the concurrency issues in multi-threaded environment

Promotes the abstract factory design pattern to resolve complex logic

Structural

These patterns display the relationship among objects and classes
and concentrates on the design of framework.

Architecture of Using Structural Patterns

Architecture of using Structural Patterns

Benefits of Decorator Design Pattern

Avoids static inheritance

Adds feature instead of static loose coupling

Restricts the traditional approach of sub-classing to add a feature in an object

Behavioral

This pattern analyzes the behavior and responsibilities of an object and
manages the communication among the framework objects.

Architecture of Using Behavioral Patterns 

Behavioral Patterns Architecture

As per the Chain of Responsibility design pattern, number of classes
handling the API request in API Testing framework

Benefits of Chain-of-Responsibility Design Pattern

Decouples the request from the sender to receiver

Manage multiple objects to handle the request at run-time

 

Conclusion

Conclusion

Utilization of design patterns is like an investment - it initially takes time but provides key benefits like fewer unforeseen issue, clean code, and smooth execution of test scripts.

Have Suggestions?

Have Suggestions?

We would love to hear your feedback, questions, comments and suggestions. This will help us to make us better and more useful next time.
Share your thoughts and ideas at knowledgecenter@qasource.com

Disclaimer

This publication is for informational purposes only, and nothing contained in it should be considered legal advice. We expressly disclaim any warranty or responsibility for damages arising out of this information and encourage you to consult with legal counsel regarding your specific needs. We do not undertake any duty to update previously posted materials.