SlideShare a Scribd company logo
1 of 65
Download to read offline
TechCon 2017
Khanh Le
Common Design Principles and
Design Patterns in Automation Testing
Introduction
Common
Design Principles
SOLID
DRY
Common
Design Pattern
POM
Fluent Page
ENDING
Agenda
Summary
Q&A
Introduction
About Me
3+ years of experience
in telecom and network.
7+ years of experience
in software testing
(manual, automation,
performance).
4+ years of experience
in company technical
Supporting Solutions,
Training and R&D.
2+ year of experience in
web security testing and
DevOps.
Common
Design Principles
O
L
S
I
Single responsibility principle
Open/closed principle
Liskov substitution principle
Interface segregation principle
SOLID PRINCIPLES
DDependency inversion principle
Every module or class should have responsibility over a single part of
the functionality provided by the software, and that responsibility should
be entirely encapsulated by the class
Single
Responsibility
Everything in the class should
be related to single purpose
Single
Responsibility
Should break them
into separate
classes base on
intended function.
With simplicity, it
will increase
readability,
understandability,
changeability and
maintainability
Dependency
Inversion
Principle
High-level modules should not
depend on low-level modules.
Both should depend on
abstractions.
Abstractions should not
depend on details. Details
should depend on
abstractions.
Copy
Read from
Keyboard
Printer
HLM: High Level Module
LLM: Low Level Module
How to write a program can read keyboard and then print this?
Dependency Inversion Principle
Dependency Inversion Principle
Dependency Inversion Principle
Dependency Inversion Principle
Copy
Read from
Keyboard
Printer
HLM
LLMWrite to
DataBase
Dependency Inversion Principle
Must modify Copy Class to interact with “Write to Database” Class
Dependency Inversion Principle
Copy
Read from
Keyboard
Include interfaces in High level module
Low level modules will implement these interfaces
Reader
Interface
Writer
Interface
Read from
Scanner
Printer
Write to
DataBase
LLM
HLM
Dependency Inversion Principle
Apply this principle
Dependency Inversion Principle
Dependency Inversion Principle
Dependency Inversion Principle
Dependency Inversion Principle
DRY PRINCIPLE
Don't Repeat Yourself
"Don't write the same code repeatedly"
Duplicated steps in test case
DRY PRINCIPLE
Duplicated steps in test case
Common
Design Patterns
POM PATTERN
A design pattern to create Object Repository for web UI elements.
There should be corresponding Page class for each web page in the application.
This Page class will find the WebElements of that web page and also contains
Page methods which perform operations on those WebElements
Operations and flows in
the UI should be
separated from
verification => our code
cleaner and easy to
understand
Code becomes less and optimized
because of the reusable page
methods in the POM classes. Methods get more realistic
names which can be easily
mapped with the operation
happening in UI
POM PATTERN
Web Page
Page
Class
Base
Page
Class
Test Report
POM PATTERN
Main TC
Sub TC
Pre-
condition
Sub TC
Step
Sub TC
Post-
condition
Page
Object
API
Data
base
Base Page
Page
Functions
Page
Validations
Business flow –
Pre and Post
Main business flow
POM PATTERN
Source: twitter.com
POM PATTERN
POM PATTERN
POM PATTERN
With Page factory
POM PATTERN
POM in Katalon – Solution 1
POM PATTERN
In business layer :
POM in Katalon – Solution 1
POM PATTERN
POM in Katalon – Solution 2
POM PATTERN
POM in Katalon – Solution 2
In business layer :
Fluent Page Pattern
POM +
Fluent
Interface
Fluent Page Pattern is POM with Fluent Interface.
A fluent interface is typically implemented by
using method cascading (concretely method chaining) to
relay the instruction context of a subsequent call.
Fluent Page Pattern
POM +
Fluent
Interface
Fluent Page Pattern
POM +
Fluent
Interface
Fluent Page Pattern
POM +
Fluent
Interface
Apply this pattern
Fluent Page Pattern
POM +
Fluent
Interface
Apply this pattern
Summary
REFERENCES
• http://www.oodesign.com/
• https://www.wikipedia.org/
• https://automatetheplanet.com
THANK YOU
Q & A
OPEN/CLOSED PRINCIPLE
”Software entities (classes, modules, functions, etc.) should be open for
extension, but closed for modification”.
Class should allow creation of new properties or methods.
Class should not allow modification of current properties or methods.
Source: wiki
OPEN/CLOSED PRINCIPLE
OPEN/CLOSED PRINCIPLE
OPEN/CLOSED PRINCIPLE
Execute “Main.java”:
We want to connect with Oracle Server, what will we do?
OPEN/CLOSED PRINCIPLE
OPEN/CLOSED PRINCIPLE
Execute “Main.java”:
OPEN/CLOSED PRINCIPLE
We will change the ConnectionManager Class when adding new
Database Connection
OPEN/CLOSED PRINCIPLE
Apply this principle
OPEN/CLOSED PRINCIPLE
LISKOV SUBSTITUTION PRINCIPLE
“Objects in a program should be replaceable with instances of their subtypes
without altering the correctness of that program.”
Source: wiki
LISKOV SUBSTITUTION PRINCIPLE
LISKOV SUBSTITUTION PRINCIPLE
LISKOV SUBSTITUTION PRINCIPLE
Replace Rectangle object to Square object for returning, the issue will come
LISKOV SUBSTITUTION PRINCIPLE
Apply this principle
LISKOV SUBSTITUTION PRINCIPLE
LISKOV SUBSTITUTION PRINCIPLE
LISKOV SUBSTITUTION PRINCIPLE
INTERFACE SEGREGATION PRINCIPLE
“Many client-specific interfaces are better than one general-purpose interface.”
”No client should be forced to depend on methods it does not use.”
ISP splits interfaces that are very large into smaller and more specific ones.
Source: wiki
INTERFACE SEGREGATION PRINCIPLE
INTERFACE SEGREGATION PRINCIPLE
When Animal interface has
more methods, all classes must
implement these methods even
if they don’t use.
INTERFACE SEGREGATION PRINCIPLE
Apply this principle
INTERFACE SEGREGATION PRINCIPLE

More Related Content

What's hot

Introduction To Single Page Application
Introduction To Single Page ApplicationIntroduction To Single Page Application
Introduction To Single Page Application
KMS Technology
 
Windows Store Apps: Tips & Tricks
Windows Store Apps: Tips & TricksWindows Store Apps: Tips & Tricks
Windows Store Apps: Tips & Tricks
Robert MacLean
 

What's hot (20)

SenchaCon 2016: Cross-Platform Mobile App Development with Cordova and Visual...
SenchaCon 2016: Cross-Platform Mobile App Development with Cordova and Visual...SenchaCon 2016: Cross-Platform Mobile App Development with Cordova and Visual...
SenchaCon 2016: Cross-Platform Mobile App Development with Cordova and Visual...
 
ASP.NET 5 & Unit Testing
ASP.NET 5 & Unit TestingASP.NET 5 & Unit Testing
ASP.NET 5 & Unit Testing
 
Testing Ajax, Mobile Apps the Agile Way
Testing Ajax, Mobile Apps the Agile WayTesting Ajax, Mobile Apps the Agile Way
Testing Ajax, Mobile Apps the Agile Way
 
Moving From a Selenium Grid to the Cloud - A Real Life Story
Moving From a Selenium Grid to the Cloud - A Real Life StoryMoving From a Selenium Grid to the Cloud - A Real Life Story
Moving From a Selenium Grid to the Cloud - A Real Life Story
 
BDD testing with cucumber
BDD testing with cucumberBDD testing with cucumber
BDD testing with cucumber
 
Introduction To Single Page Application
Introduction To Single Page ApplicationIntroduction To Single Page Application
Introduction To Single Page Application
 
The state of testing @ Microsoft
The state of testing @ MicrosoftThe state of testing @ Microsoft
The state of testing @ Microsoft
 
Windows Store Apps: Tips & Tricks
Windows Store Apps: Tips & TricksWindows Store Apps: Tips & Tricks
Windows Store Apps: Tips & Tricks
 
Use Jenkins For Continuous Load Testing And Mobile Test Automation
Use Jenkins For Continuous Load Testing And Mobile Test AutomationUse Jenkins For Continuous Load Testing And Mobile Test Automation
Use Jenkins For Continuous Load Testing And Mobile Test Automation
 
ASP.NET & Unit Testing
ASP.NET & Unit TestingASP.NET & Unit Testing
ASP.NET & Unit Testing
 
Lean Quality & Engineering
Lean Quality & EngineeringLean Quality & Engineering
Lean Quality & Engineering
 
Continuous Integration, Deploy, Test From Beginning To End 2014
Continuous Integration, Deploy, Test From Beginning To End 2014Continuous Integration, Deploy, Test From Beginning To End 2014
Continuous Integration, Deploy, Test From Beginning To End 2014
 
Web based automation testing on Node.js environment
Web based automation testing on Node.js environmentWeb based automation testing on Node.js environment
Web based automation testing on Node.js environment
 
Real-World Boot-Up Sequences - QuickBooks Self-Employed
Real-World Boot-Up Sequences - QuickBooks Self-EmployedReal-World Boot-Up Sequences - QuickBooks Self-Employed
Real-World Boot-Up Sequences - QuickBooks Self-Employed
 
Automated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choiceAutomated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choice
 
Visual Automation Framework via Screenshot Comparison
Visual Automation Framework via Screenshot ComparisonVisual Automation Framework via Screenshot Comparison
Visual Automation Framework via Screenshot Comparison
 
Patterns and practices for building enterprise-scale HTML5 apps
Patterns and practices for building enterprise-scale HTML5 appsPatterns and practices for building enterprise-scale HTML5 apps
Patterns and practices for building enterprise-scale HTML5 apps
 
Perils of Page-Object Pattern
Perils of Page-Object PatternPerils of Page-Object Pattern
Perils of Page-Object Pattern
 
Automated Testing – Web, Mobile, Desktop - Challenges and Successes
Automated Testing – Web, Mobile, Desktop - Challenges and SuccessesAutomated Testing – Web, Mobile, Desktop - Challenges and Successes
Automated Testing – Web, Mobile, Desktop - Challenges and Successes
 
Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011
 

Similar to Common design principles and design patterns in automation testing

"Up-Down Development & DSL-first approach", Владимир Мельник, DataArt
 "Up-Down Development & DSL-first approach", Владимир Мельник, DataArt "Up-Down Development & DSL-first approach", Владимир Мельник, DataArt
"Up-Down Development & DSL-first approach", Владимир Мельник, DataArt
DataArt
 
P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
Gaurav Tyagi
 
SOLID principles-Present
SOLID principles-PresentSOLID principles-Present
SOLID principles-Present
Quang Nguyen
 

Similar to Common design principles and design patterns in automation testing (20)

"Up-Down Development & DSL-first approach", Владимир Мельник, DataArt
 "Up-Down Development & DSL-first approach", Владимир Мельник, DataArt "Up-Down Development & DSL-first approach", Владимир Мельник, DataArt
"Up-Down Development & DSL-first approach", Владимир Мельник, DataArt
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and Selenium
 
Performance analysis of synchronisation problem
Performance analysis of synchronisation problemPerformance analysis of synchronisation problem
Performance analysis of synchronisation problem
 
Solid principle
Solid principleSolid principle
Solid principle
 
Evolutionary Design Solid
Evolutionary Design SolidEvolutionary Design Solid
Evolutionary Design Solid
 
Selenium Design Patterns
Selenium Design PatternsSelenium Design Patterns
Selenium Design Patterns
 
Reusable Apps
Reusable AppsReusable Apps
Reusable Apps
 
Clean architecture with asp.net core
Clean architecture with asp.net coreClean architecture with asp.net core
Clean architecture with asp.net core
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Day1
Day1Day1
Day1
 
King Tut Architecture
King Tut ArchitectureKing Tut Architecture
King Tut Architecture
 
P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
 
GoF Design patterns I: Introduction + Structural Patterns
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural Patterns
 
DesignPrinciples-and-DesignPatterns
DesignPrinciples-and-DesignPatternsDesignPrinciples-and-DesignPatterns
DesignPrinciples-and-DesignPatterns
 
SOLID principles-Present
SOLID principles-PresentSOLID principles-Present
SOLID principles-Present
 
St Hilaire Ajax Start Odtug Nov 2009
St Hilaire   Ajax Start Odtug Nov 2009St Hilaire   Ajax Start Odtug Nov 2009
St Hilaire Ajax Start Odtug Nov 2009
 
Design Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The WorldDesign Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The World
 
Immutable Data and TypeScript in an Ember.js Application
Immutable Data and TypeScript in an Ember.js ApplicationImmutable Data and TypeScript in an Ember.js Application
Immutable Data and TypeScript in an Ember.js Application
 
Advanced OOP - Laws, Principles, Idioms
Advanced OOP - Laws, Principles, IdiomsAdvanced OOP - Laws, Principles, Idioms
Advanced OOP - Laws, Principles, Idioms
 
Improving the Quality of Existing Software
Improving the Quality of Existing SoftwareImproving the Quality of Existing Software
Improving the Quality of Existing Software
 

More from KMS Technology

Technology Application Development Trends For IT Students
Technology Application Development Trends For IT StudentsTechnology Application Development Trends For IT Students
Technology Application Development Trends For IT Students
KMS Technology
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
KMS Technology
 

More from KMS Technology (20)

A journey to a Full Stack Tester
A journey to a Full Stack Tester A journey to a Full Stack Tester
A journey to a Full Stack Tester
 
KMSNext Roadmap
KMSNext RoadmapKMSNext Roadmap
KMSNext Roadmap
 
KMS Introduction
KMS IntroductionKMS Introduction
KMS Introduction
 
What's new in the Front-end development nowadays?
What's new in the Front-end development nowadays?What's new in the Front-end development nowadays?
What's new in the Front-end development nowadays?
 
JavaScript - No Longer A Toy Language
JavaScript - No Longer A Toy LanguageJavaScript - No Longer A Toy Language
JavaScript - No Longer A Toy Language
 
JavaScript No longer A “toy” Language
JavaScript No longer A “toy” LanguageJavaScript No longer A “toy” Language
JavaScript No longer A “toy” Language
 
Preparations For A Successful Interview
Preparations For A Successful InterviewPreparations For A Successful Interview
Preparations For A Successful Interview
 
AWS: Scaling With Elastic Beanstalk
AWS: Scaling With Elastic BeanstalkAWS: Scaling With Elastic Beanstalk
AWS: Scaling With Elastic Beanstalk
 
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
 
KMS Introduction
KMS IntroductionKMS Introduction
KMS Introduction
 
Technology Application Development Trends For IT Students
Technology Application Development Trends For IT StudentsTechnology Application Development Trends For IT Students
Technology Application Development Trends For IT Students
 
Contributors for Delivering a Successful Testing Project Seminar
Contributors for Delivering a Successful Testing Project SeminarContributors for Delivering a Successful Testing Project Seminar
Contributors for Delivering a Successful Testing Project Seminar
 
Increase Chances to Be Hired as Software Developers - 2014
Increase Chances to Be Hired as Software Developers - 2014Increase Chances to Be Hired as Software Developers - 2014
Increase Chances to Be Hired as Software Developers - 2014
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
 
Software Technology Trends in 2013-2014
Software Technology Trends in 2013-2014Software Technology Trends in 2013-2014
Software Technology Trends in 2013-2014
 
Cross-platform Mobile Development with C# and Xamarin Webinar
Cross-platform Mobile Development with C# and Xamarin WebinarCross-platform Mobile Development with C# and Xamarin Webinar
Cross-platform Mobile Development with C# and Xamarin Webinar
 
Software Testing Process & Trend
Software Testing Process & TrendSoftware Testing Process & Trend
Software Testing Process & Trend
 
Mobile Development Career
Mobile Development CareerMobile Development Career
Mobile Development Career
 
Become Software Tester or Developer
Become Software Tester or DeveloperBecome Software Tester or Developer
Become Software Tester or Developer
 
Software Technology Trends
Software Technology TrendsSoftware Technology Trends
Software Technology Trends
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 

Common design principles and design patterns in automation testing