Software Design Patterns in Test Automation

Slides:



Advertisements
Similar presentations
Welcome to. Who am I? A better way to code Design Patterns ???  What are design patterns?  How many are there?  How do I use them?  When do I use.
Advertisements

JDBC Session 4 Tonight: Design Patterns 1.Introduction To Design Patterns 2.The Factory Pattern 3.The Facade Pattern Thursday & Next Tuesday: Data Access.
Object-Oriented Analysis and Design
(c) 2009 University of California, Irvine – André van der Hoek1June 13, 2015 – 21:42:16 Informatics 122 Software Design II Lecture 8 André van der Hoek.
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
Design and Programming Patterns Associated with Java Networking by Margaret Toews cs843, Spring 2003.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
Analysis Stage (Phase I) The goal: understanding the customer's requirements for a software system. n involves technical staff working with customers n.
Ralph Johnson - University of Illinois1 Patterns: What They Are, and How to Write Them Ralph Johnson University of Illinois at Urbana-Champaign
(c) 2010 University of California, Irvine – André van der Hoek1June 29, 2015 – 08:55:05 Informatics 122 Software Design II Lecture 8 André van der Hoek.
Chapter 8 Object Design Reuse and Patterns. Finding Objects The hardest problems in object-oriented system development are: –Identifying objects –Decomposing.
Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 1 Object-Oriented Analysis and Design - CDT309 Period 4, Spring 2008 Design Patterns: someone has already.
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Introduction to software design patterns For CSE 3902 By: Matt Boggus.
Refining the Requirements Model
Design Patterns.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
RUP Implementation and Testing
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Architecture GRASP Realization of use cases in interaction diagrams Design class diagram Design ( how )
D ESIGN P ATTERNS Breno Batista Machado Weslei A. de T. Marinho.
CIS764 Fall CIS 764 Database Systems Design J2EE Patterns Book Review Presented by Mark Weiss.
January 12, Introduction to Design Patterns Tim Burke References: –Gamma, Erich, et. al. (AKA, The Gang of Four). Design Patterns: Elements of Reusable.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 27. Review UML dynamic view – State Diagrams.
Design Patterns. Patterns “Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution.
CSE 219 Computer Science III Program Design Principles.
Object-Oriented Design Principles and Patterns. © 2005, James R. Vallino2 How Do You Design? What principles guide you when you create a design? What.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
D ESIGN P ATTERNS Weslei A. de T. Marinho. T ALK O UTLINE Pattern Definition GRASP Patterns GoF Patterns GoF Patterns Classification Creational Patterns.
GRASP: Designing Objects with Responsibilities
03/12/2001 © Bennett, McRobb and Farmer 2005 Refining the Requirements Model Based on Chapter 8 of Bennett, McRobb and Farmer: Object Oriented Systems.
L11-12: Design Patterns Definition Iterator (L4: Inheritance)‏ Factory (L4: Inheritance)‏ Strategy (L5: Multiple Inheritance)‏ Composite (L6: Implementation.
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
CSE 403 Lecture 14 Design Patterns. Today’s educational objective Understand the basics of design patterns Be able to distinguish them from design approaches.
Unit 4 Object-Oriented Design Patterns NameStudent Number CAI XIANGHT082182A KYAW THU LINHT082238Y LI PENGFEIHT082220L NAUNG NAUNG LATTHT082195L PLATHOTTAM.
Design Principle & Patterns by A.Surasit Samaisut Copyrights : All Rights Reserved.
ECE450S – Software Engineering II
CSC 480 Software Engineering Design With Patterns.
Design Patterns By Mareck Kortylevitch and Piotreck Ratchinsky.
Patterns Roberto Damiani Mendes. Roteiro Definition; Definition; Architecture Patterns; Architecture Patterns; Design Patterns; Design Patterns; GRASP.
Software Design Patterns Curtsy: Fahad Hassan (TxLabs)
Design Patterns: Elements of Reusable Object- Orientated Software Gamma, Helm, Johnson, Vlissides Presented By: David Williams.
Design Patterns Introduction
1 Chapter 5:Design Patterns. 2 What are design pattern?  Schematic description of design solution to recurring problems in software design and,  Reusable.
CSC 480 Software Engineering Design With Patterns.
Copyright © Craig Larman All Rights Reserved COMP-350 Object-Oriented Analysis and Design GRASP: Designing Objects with Responsibilities Reference:
CS 210 Proxy Pattern Nov 16 th, RMI – A quick review A simple, easy to understand tutorial is located here:
21/1/ Analysis - Model of real-world situation - What ? System Design - Overall architecture (sub-systems) Object Design - Refinement of Design.
Software Design Derived from Dr. Fawcett’s slides CSE784 – Software Studio Fall 2009.
Class Relationships Lecture Oo08 Polymorphism. References n Booch, et al, The Unified Modeling Language User Guide, Chapt 10 p.125 n Fowler & Scott, UML.
1 Good Object-Oriented Design Dr. Radu Marinescu Lecture 4 Introduction to Design Patterns.
Beginning Software Craftsmanship Brendan Enrick Steve Smith
TEMPLATE METHOD DESIGN PATTERN -SWAPNIL SHAH. WHAT IS A DESIGN PATTERN… A design pattern is a general reusable solution to a commonly occurring problem.
GRASP – Designing Objects with Responsibilities
Design Patterns: MORE Examples
Design Patterns: Brief Examples
Chapter 5:Design Patterns
Introduction to Design Patterns
Introduction to Design Patterns
Behavioral Design Patterns
Software Engineering Lecture 7 - Design Patterns
Informatics 122 Software Design II
Patterns.
Object Oriented Design Patterns - Behavioral Patterns
CSC 480 Software Engineering
Informatics 122 Software Design II
CSC 480 Software Engineering
Refining the Requirements Model
Presentation transcript:

Software Design Patterns in Test Automation

Table of Content Objectives What are Design Patterns? Design Pattern and Design Principle - what's the difference? Principles KISS Don’t Repeat Yourself. 5. Patterns Multi-layered test solution Facade Chaining Template Method

Objectives Present the concepts of „design pattern” & „design principle” Show why these concepts are important Describe chosen patterns & principles. All presented patterns have examples in C# but can be used with most Object-Oriented Languages Target Audience: Testers who are writing automated tests and want to dive deeper into programing world.

Software Design Pattern General reusable solution to a commonly occuring problem within given context Object-Oriented Desgin Patterns typically show relationships between classes and objects without specifing theirs final application. (a pattern) „describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same ay twice„- Christopher Alexander

Pattern vs Principle Software Design Principle - Set of Guidelines that helps to avoid bad design and unmaintainable code. „Design principles are the desirable goals that one aims to achieve. Design patterns are tools one can use to realize those goals. ” – E Arimitage

KISS Keep it simple stupid. (KISS)

KISS – Example

KISS – Example

Solution

DRY Don’t Repeat yourself (DRY)

DRY - Example

Solution

Time for Patterns

Multi Layered Test Solution Strategy Multi Layered Test Solution

Overview

Example

Pros & Cons Low maintenance effort and time Enhanced code reusability Structured codebase which is easy to fix and extend Improved communication Complexity Time invested during creation Experience

Facade Facade

Facade provides an unified interface in subsystem. Facade – description Facade provides an unified interface in subsystem. Defines a higher-level interface that makes the subsystem easier to use.

Facade – UML

Verify if PayPal is available payment method Facade - Test Case Login as Normal User Add product to cart Go to checkout Verify if PayPal is available payment method

Facade – Before

Facade –After

Facade – Front Facade Implementation

Less time spent on writing new test cases Easier maintenance. Pros & Cons Less time spent on writing new test cases Easier maintenance. Test is harder to debug if it fails in ‚unexpected’ way. Test is unreadable – if treated as an Unit Test.

Methods Chaining

Methods Chaining- Example

Chaining – methods difference

Pros & Cons Helps when writing tests Clean Code & Readability Person can’t see what object is returned Chain breaks

Template Method

Template Method– description Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.

Template Method– UML

Template Method -Test Cases Buy Product Go To Checkout Validate PayPal Payment Buy Product Go To Checkout Validate Payment On Delivery

Template Method - Example

Template Method - Example

Quite hard to understand To understand what going on in test Pros & Cons Avoiding God Class Modularization Quite hard to understand To understand what going on in test ‚little digging’ is neccesary

Design patterns are more like guidelines Summary Design patterns are more like guidelines Patterns can be bad if used in wrong context Anybody can use them Do not force patterns into your code!!! Anti-Patterns

Head First Design Patterns – O’Reily Media Bibliography http://dofactory.com/net/design-patterns Head First Design Patterns – O’Reily Media Design Patterns: Elements of Reusable Object-Oriented Software

Questions?

Contact Us wyrodek.maciej@gmail.com wilczynskikrzysztofq@gmail.com

Thank you for your attention Krzysztof Wilczyński & Maciej Wyrodek