Post on 23-Jan-2018
Introduction
Common
Design Principles
SOLID
DRY
Common
Design Pattern
POM
Fluent Page
ENDING
Agenda
Summary
Q&A
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.
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
KeyboardPrinter
HLM: High Level Module
LLM: Low Level Module
How to write a program can read keyboard and then print this?
Dependency Inversion Principle
Copy
Read from
Keyboard
Include interfaces in High level module
Low level modules will implement these interfaces
Reader
InterfaceWriter
Interface
Read from
ScannerPrinter
Write to
DataBaseLLM
HLM
DRY PRINCIPLE
Don't Repeat Yourself
"Don't write the same code repeatedly"
Duplicated steps in test case
POM PATTERNA 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
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 PostMain business flow
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.
REFERENCES
• http://www.oodesign.com/
• https://www.wikipedia.org/
• https://automatetheplanet.com
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
We will change the ConnectionManager Class when adding new
Database Connection
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
Replace Rectangle object to Square object for returning, the issue will come
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
When Animal interface has
more methods, all classes must
implement these methods even
if they don’t use.