O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
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,
pe...
Common
Design Principles
O
L
S
I
Single responsibility principle
Open/closed principle
Liskov substitution principle
Interface segregation principl...
Every module or class should have responsibility over a single part of
the functionality provided by the software, and tha...
Single
Responsibility
Should break them
into separate
classes base on
intended function.
With simplicity, it
will increase...
Dependency
Inversion
Principle
High-level modules should not
depend on low-level modules.
Both should depend on
abstractio...
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 impl...
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...
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
Func...
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 typical...
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 ...
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 alterin...
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 clien...
INTERFACE SEGREGATION PRINCIPLE
INTERFACE SEGREGATION PRINCIPLE
When Animal interface has
more methods, all classes must
implement these methods even
if t...
INTERFACE SEGREGATION PRINCIPLE
Apply this principle
INTERFACE SEGREGATION PRINCIPLE
Common design principles and design patterns in automation testing
Terminou este documento.
Transfira e leia offline.
Próximos SlideShares
What to Upload to SlideShare
Avançar
Próximos SlideShares
What to Upload to SlideShare
Avançar
Transfira para ler offline e ver em ecrã inteiro.

Compartilhar

Common design principles and design patterns in automation testing

Baixar para ler offline

Topic: Common Design Principles and Design Patterns in Automation Testing
Speaker: Khanh Le

Common design principles and design patterns in automation testing

  1. 1. TechCon 2017 Khanh Le Common Design Principles and Design Patterns in Automation Testing
  2. 2. Introduction Common Design Principles SOLID DRY Common Design Pattern POM Fluent Page ENDING Agenda Summary Q&A
  3. 3. Introduction
  4. 4. 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.
  5. 5. Common Design Principles
  6. 6. O L S I Single responsibility principle Open/closed principle Liskov substitution principle Interface segregation principle SOLID PRINCIPLES DDependency inversion principle
  7. 7. 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
  8. 8. Single Responsibility Should break them into separate classes base on intended function. With simplicity, it will increase readability, understandability, changeability and maintainability
  9. 9. 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?
  10. 10. Dependency Inversion Principle
  11. 11. Dependency Inversion Principle
  12. 12. Dependency Inversion Principle
  13. 13. Dependency Inversion Principle Copy Read from Keyboard Printer HLM LLMWrite to DataBase
  14. 14. Dependency Inversion Principle Must modify Copy Class to interact with “Write to Database” Class
  15. 15. 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
  16. 16. Dependency Inversion Principle Apply this principle
  17. 17. Dependency Inversion Principle
  18. 18. Dependency Inversion Principle
  19. 19. Dependency Inversion Principle
  20. 20. Dependency Inversion Principle
  21. 21. DRY PRINCIPLE Don't Repeat Yourself "Don't write the same code repeatedly" Duplicated steps in test case
  22. 22. DRY PRINCIPLE Duplicated steps in test case
  23. 23. Common Design Patterns
  24. 24. 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
  25. 25. POM PATTERN Web Page Page Class Base Page Class Test Report
  26. 26. 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
  27. 27. POM PATTERN Source: twitter.com
  28. 28. POM PATTERN
  29. 29. POM PATTERN
  30. 30. POM PATTERN With Page factory
  31. 31. POM PATTERN POM in Katalon – Solution 1
  32. 32. POM PATTERN In business layer : POM in Katalon – Solution 1
  33. 33. POM PATTERN POM in Katalon – Solution 2
  34. 34. POM PATTERN POM in Katalon – Solution 2 In business layer :
  35. 35. 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.
  36. 36. Fluent Page Pattern POM + Fluent Interface
  37. 37. Fluent Page Pattern POM + Fluent Interface
  38. 38. Fluent Page Pattern POM + Fluent Interface Apply this pattern
  39. 39. Fluent Page Pattern POM + Fluent Interface Apply this pattern
  40. 40. Summary
  41. 41. REFERENCES • http://www.oodesign.com/ • https://www.wikipedia.org/ • https://automatetheplanet.com
  42. 42. THANK YOU Q & A
  43. 43. 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
  44. 44. OPEN/CLOSED PRINCIPLE
  45. 45. OPEN/CLOSED PRINCIPLE
  46. 46. OPEN/CLOSED PRINCIPLE Execute “Main.java”: We want to connect with Oracle Server, what will we do?
  47. 47. OPEN/CLOSED PRINCIPLE
  48. 48. OPEN/CLOSED PRINCIPLE Execute “Main.java”:
  49. 49. OPEN/CLOSED PRINCIPLE We will change the ConnectionManager Class when adding new Database Connection
  50. 50. OPEN/CLOSED PRINCIPLE Apply this principle
  51. 51. OPEN/CLOSED PRINCIPLE
  52. 52. LISKOV SUBSTITUTION PRINCIPLE “Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.” Source: wiki
  53. 53. LISKOV SUBSTITUTION PRINCIPLE
  54. 54. LISKOV SUBSTITUTION PRINCIPLE
  55. 55. LISKOV SUBSTITUTION PRINCIPLE Replace Rectangle object to Square object for returning, the issue will come
  56. 56. LISKOV SUBSTITUTION PRINCIPLE Apply this principle
  57. 57. LISKOV SUBSTITUTION PRINCIPLE
  58. 58. LISKOV SUBSTITUTION PRINCIPLE
  59. 59. LISKOV SUBSTITUTION PRINCIPLE
  60. 60. 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
  61. 61. INTERFACE SEGREGATION PRINCIPLE
  62. 62. INTERFACE SEGREGATION PRINCIPLE When Animal interface has more methods, all classes must implement these methods even if they don’t use.
  63. 63. INTERFACE SEGREGATION PRINCIPLE Apply this principle
  64. 64. INTERFACE SEGREGATION PRINCIPLE
  • GeoWhizz

    May. 30, 2019
  • holaszkati

    Mar. 16, 2018

Topic: Common Design Principles and Design Patterns in Automation Testing Speaker: Khanh Le

Vistos

Vistos totais

1.024

No Slideshare

0

De incorporações

0

Número de incorporações

2

Ações

Baixados

43

Compartilhados

0

Comentários

0

Curtir

2

×