SlideShare a Scribd company logo
1 of 59
Download to read offline
Write the test
that you’d want
to read!
by Stanislaw Potoczny
Agenda
1. Introduction
2. Geb framework
3. Test architecture definition
4. Test architecture implementation
for Selenium WebDriver
The Beginning
SmartRecruiters
● Microservices (#200)
● Kubernetes
● Docker
● Angular
● Node
● Halogen
● GEB for E2e tests
GEB
Geb is a browser automation solution.
It brings together the power of WebDriver, the elegance of
jQuery content selection, the robustness of Page Object
modelling and the expressiveness of the Groovy language.
GEB - Page Object and Module
Geb implements a Page Object pattern via its
Module and Page class (user extends those
classes when creating it own)
Each Page object is consisted of three main
parts:
● Static URL
● Static At
● Static Content
Module represents a reusable unit
of Page content its structure is:
● Static Content
GEB - Page Object
GEB - Page Object
GEB - Page Object
GEB - Page Object
GEB - Page Object
GEB - Page Object
GEB - Page Object and Module
GEB - Page Object and Module
GEB - JQuery content selection - $()
GEB - JQuery content selection - $()
GEB - JQuery content selection - $()
GEB - JQuery content selection - $()
GEB - JQuery content selection - $()
And the reality...
How the reality looks like
● Slow
● Unstable
● No standard
● Hard to maintain
○ Refactor
○ To big page objects
○ Developer reluctance
● One repo for everything
● No ownership defined
Test Architecture
Test Class Controller Page Object
View Controller Model
Test Class Page Object
GEB/Selenium Yeah Pages
+ Whatever I need + Whatever I need
Page Object as Model
Only locators and possibilities
of how to interact with them
Controller
Controllers gathers actions
available on the page objects
in order to perform a business
action.
Controller
Controllers gathers actions
available on the page objects
in order to perform a business
action.
Controller
Controllers gathers actions
available on the page objects
in order to perform a business
action.
Controller
Controllers gathers actions
available on the page objects
in order to perform a business
action.
Test scenario as a view
View uses methods defined in
the controller written in high
level language.
View provides test data
WebDriver implementation
But we do not have GEB we
have got clean selenium…
We do not know Groovy...
WebDriver implementation
If your project is Java based
then you might consider use
Groovy and Groovy based
testing frameworks like GEB
and Spock.
Groovy is relatively easy for
Java developers and it brings
to the table lot of magic that
decreases test verbosity
WebDriver implementation
But we still do not want to...
WebDriver implementation
Then similar effects you can
obtain using Page Object
pattern, Java 8 default
methods in interfaces with
combination with fluent style
programming.
WebDriver implementation - problem
Simple test yet it is not visible
at the first glance
WebDriver implementation - problem
Simple test yet it is not visible
at the first glance
Selectors in a test class..
WebDriver implementation - problem
Simple test yet it is not visible
at the first glance
Selectors in a test class..
Test class does everything…
WebDriver implementation - problem
Simple test yet it is not visible
at the first glance
Selectors in a test class..
Test class does everything…
It slows down reading speed…
Increases frustration and most
importantly onboarding time of
the new less experienced
team members
WebDriver - What we want!
Test written in natural to the user
language, configuration and details
are abstracted away.
WebDriver - How To
1. Create abstract BaseTestClass - this class will hold all driver
configuration actions as well as clean up actions
2. Delegate Driver creation to the DriverFactory utility class
WebDriver - How To
1. Create abstract BaseTestClass - this class will hold all driver
configuration actions as well as clean up actions
2. Delegate Driver creation to the DriverFactory utility class
WebDriver - How To
WebDriver - How To -BasePageClass
3. Create abstract BasePageClass that will have common methods ex. $()
WebDriver - How To -BasePageClass
3. Create abstract BasePageClass that will have common methods ex. $()
WebDriver - How To -BasePageClass
3. Create abstract BasePageClass that will have common methods ex. $()
4. Create Page class that will
extend BasePageClass
WebDriver - How To
-BasePageClass
4. Create Page class that will
extend BasePageClass
5. Create locator definitions and
methods to operate on them
(see that Page do not consist
any business logic)
WebDriver - How To
-BasePageClass
4. Create Page class that will
extend BasePageClass
5. Create locator definitions and
methods to operate on them
(see that Page do not consist
any business logic)
WebDriver - How To
-BasePageClass
4. Create Page class that will
extend BasePageClass
5. Create locator definitions and
methods to operate on them
(see that Page do not consist
any business logic)
6. Apply method chaining (it is a
one way of fluent style
application)
WebDriver - How To
-BasePageClass
4. Create Page class that will
extend BasePageClass
5. Create locator definitions and
methods to operate on them
(see that Page do not consist
any business logic)
6. Apply method chaining (it is a
one way of fluent style
application)
WebDriver - How To
-BasePageClass
7. Create Interface that will
contain default methods. This
methods should gather actions
in a chain in order to perform a
business logic on the Page.
WebDriver - How To - Controllers
7. Create Interface that will
contain default methods. This
methods should gather actions
in a chain in order to perform a
business logic on the Page.
WebDriver - How To - Controllers
7. Create Interface that will
contain default methods. This
methods should gather actions
in a chain in order to perform a
business logic on the Page.
WebDriver - How To - Controllers
WebDriver - Putting all together
Takeaways - Why GEB
● Based on Selenium WebDriver
● Page Object is main focus of the framework
● jQuery style content selection
● Uses Groovy language
● WebDriver is a W3C recommendation
● Easy to start
● Productivity
To be honest, good E2E tests can be obtained without
GEB… and having a GEB do not ensure well written E2E
test as previously saw.
Think of the test architecture upfront so you won’t land
with a test suite that has to be refactored to the ground
Takeaways - Why GEB
Takeaways - Writing clear tests
● It helps with test maintainability
● It improves readability by providing human
friendly dsl
● It helps with onboarding new team
members
● It encourages reusability
● It is easier to debug if we know at which
step test failed
● It lives room for new testing approaches.
Thank You For Your Attention
Q&A?

More Related Content

What's hot

Angular js tutorial slides
Angular js tutorial slidesAngular js tutorial slides
Angular js tutorial slides
samhelman
 

What's hot (20)

React Vs AnagularJS
React Vs AnagularJSReact Vs AnagularJS
React Vs AnagularJS
 
Angular js tutorial slides
Angular js tutorial slidesAngular js tutorial slides
Angular js tutorial slides
 
AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)
 
[Srijan Wednesday Webinars] Developing Large Scale Applications in AngularJS
[Srijan Wednesday Webinars] Developing Large Scale Applications in AngularJS[Srijan Wednesday Webinars] Developing Large Scale Applications in AngularJS
[Srijan Wednesday Webinars] Developing Large Scale Applications in AngularJS
 
AngularJS One Day Workshop
AngularJS One Day WorkshopAngularJS One Day Workshop
AngularJS One Day Workshop
 
AngularJS application architecture
AngularJS application architectureAngularJS application architecture
AngularJS application architecture
 
Polymer vs other libraries (Devfest Ukraine 2015)
Polymer vs other libraries (Devfest Ukraine 2015)Polymer vs other libraries (Devfest Ukraine 2015)
Polymer vs other libraries (Devfest Ukraine 2015)
 
Real World Web components
Real World Web componentsReal World Web components
Real World Web components
 
Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0 Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0
 
Polymer and web component
Polymer and web componentPolymer and web component
Polymer and web component
 
Angularjs architecture
Angularjs architectureAngularjs architecture
Angularjs architecture
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
AngularJS introduction
AngularJS introductionAngularJS introduction
AngularJS introduction
 
AngularJS
AngularJSAngularJS
AngularJS
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web Components
 
Booting up with polymer
Booting up with polymerBooting up with polymer
Booting up with polymer
 
Web Components for Java Developers
Web Components for Java DevelopersWeb Components for Java Developers
Web Components for Java Developers
 
ReactJs
ReactJsReactJs
ReactJs
 
Google Polymer Introduction
Google Polymer IntroductionGoogle Polymer Introduction
Google Polymer Introduction
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
 

Similar to Stanislaw potoczny kra_qa_21.01.20

Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testing
drewz lin
 
Chapter15-Presentation.pptx
Chapter15-Presentation.pptxChapter15-Presentation.pptx
Chapter15-Presentation.pptx
GFRomano
 
Agile NCR 2013 - Gaurav Bansal- web_automation
Agile NCR 2013 - Gaurav Bansal- web_automationAgile NCR 2013 - Gaurav Bansal- web_automation
Agile NCR 2013 - Gaurav Bansal- web_automation
AgileNCR2013
 
Effective testing of rich internet applications
Effective testing of rich internet applicationsEffective testing of rich internet applications
Effective testing of rich internet applications
Rashwin
 

Similar to Stanislaw potoczny kra_qa_21.01.20 (20)

Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect ModelComprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
 
AngularJS Beginner Day One
AngularJS Beginner Day OneAngularJS Beginner Day One
AngularJS Beginner Day One
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testing
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest services
 
Chapter15-Presentation.pptx
Chapter15-Presentation.pptxChapter15-Presentation.pptx
Chapter15-Presentation.pptx
 
Node.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java sideNode.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java side
 
From Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) AgainFrom Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) Again
 
Agile NCR 2013 - Gaurav Bansal- web_automation
Agile NCR 2013 - Gaurav Bansal- web_automationAgile NCR 2013 - Gaurav Bansal- web_automation
Agile NCR 2013 - Gaurav Bansal- web_automation
 
Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJS
 
Step by step - Selenium 3 web-driver - From Scratch
Step by step - Selenium 3 web-driver - From Scratch  Step by step - Selenium 3 web-driver - From Scratch
Step by step - Selenium 3 web-driver - From Scratch
 
AngularJs
AngularJsAngularJs
AngularJs
 
Angularjs 131211063348-phpapp01
Angularjs 131211063348-phpapp01Angularjs 131211063348-phpapp01
Angularjs 131211063348-phpapp01
 
ME vs WEB - AngularJS Fundamentals
ME vs WEB - AngularJS FundamentalsME vs WEB - AngularJS Fundamentals
ME vs WEB - AngularJS Fundamentals
 
Angular js
Angular jsAngular js
Angular js
 
Jbehave selenium
Jbehave seleniumJbehave selenium
Jbehave selenium
 
Effective testing of rich internet applications
Effective testing of rich internet applicationsEffective testing of rich internet applications
Effective testing of rich internet applications
 
Frontend Workflow
Frontend WorkflowFrontend Workflow
Frontend Workflow
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
 
The WebView Role in Hybrid Applications
The WebView Role in Hybrid ApplicationsThe WebView Role in Hybrid Applications
The WebView Role in Hybrid Applications
 
Protractor overview
Protractor overviewProtractor overview
Protractor overview
 

More from kraqa

Od Produktywności do Sabotażu - Sławomir Radzymiński, KraQA #31
Od Produktywności do Sabotażu - Sławomir Radzymiński, KraQA #31Od Produktywności do Sabotażu - Sławomir Radzymiński, KraQA #31
Od Produktywności do Sabotażu - Sławomir Radzymiński, KraQA #31
kraqa
 

More from kraqa (20)

RestAssured w sluzbie testow API
RestAssured w sluzbie testow APIRestAssured w sluzbie testow API
RestAssured w sluzbie testow API
 
Postman - podstawy testowania REST API
Postman - podstawy testowania REST APIPostman - podstawy testowania REST API
Postman - podstawy testowania REST API
 
Machine learning powered regression - KraQA 42 - Pawel Dyrek
Machine learning powered regression - KraQA 42 - Pawel Dyrek Machine learning powered regression - KraQA 42 - Pawel Dyrek
Machine learning powered regression - KraQA 42 - Pawel Dyrek
 
Kontrakt testy - KraQA 42 - Slawomir Radzyminski
Kontrakt testy - KraQA 42 - Slawomir RadzyminskiKontrakt testy - KraQA 42 - Slawomir Radzyminski
Kontrakt testy - KraQA 42 - Slawomir Radzyminski
 
KraQA#41 - PageFactory
KraQA#41 - PageFactoryKraQA#41 - PageFactory
KraQA#41 - PageFactory
 
KraQA#39 - Jak testowac tool do testow
KraQA#39 - Jak testowac tool do testowKraQA#39 - Jak testowac tool do testow
KraQA#39 - Jak testowac tool do testow
 
Hyperion - wystarczy jeden shake
Hyperion - wystarczy jeden shakeHyperion - wystarczy jeden shake
Hyperion - wystarczy jeden shake
 
Wybor urzadzen mobilnych do testow
Wybor urzadzen mobilnych do testowWybor urzadzen mobilnych do testow
Wybor urzadzen mobilnych do testow
 
Continuous security
Continuous securityContinuous security
Continuous security
 
Let s meet inside
Let s meet insideLet s meet inside
Let s meet inside
 
O wezu przy kawie
O wezu przy kawieO wezu przy kawie
O wezu przy kawie
 
Strategia do automatów
Strategia do automatówStrategia do automatów
Strategia do automatów
 
Z czym do api
Z czym do apiZ czym do api
Z czym do api
 
Jenkins pipelines
Jenkins pipelinesJenkins pipelines
Jenkins pipelines
 
Testy UI
Testy UITesty UI
Testy UI
 
Tester w pułapce myślenia
Tester w pułapce myśleniaTester w pułapce myślenia
Tester w pułapce myślenia
 
Kiedy tester zostaje managerem
Kiedy tester zostaje manageremKiedy tester zostaje managerem
Kiedy tester zostaje managerem
 
KraQA#32 - RODO
KraQA#32 - RODOKraQA#32 - RODO
KraQA#32 - RODO
 
SkładQA 2018 - Daniel Dec
SkładQA 2018 - Daniel DecSkładQA 2018 - Daniel Dec
SkładQA 2018 - Daniel Dec
 
Od Produktywności do Sabotażu - Sławomir Radzymiński, KraQA #31
Od Produktywności do Sabotażu - Sławomir Radzymiński, KraQA #31Od Produktywności do Sabotażu - Sławomir Radzymiński, KraQA #31
Od Produktywności do Sabotażu - Sławomir Radzymiński, KraQA #31
 

Recently uploaded

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Recently uploaded (20)

Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 

Stanislaw potoczny kra_qa_21.01.20

  • 1. Write the test that you’d want to read! by Stanislaw Potoczny
  • 2. Agenda 1. Introduction 2. Geb framework 3. Test architecture definition 4. Test architecture implementation for Selenium WebDriver
  • 3. The Beginning SmartRecruiters ● Microservices (#200) ● Kubernetes ● Docker ● Angular ● Node ● Halogen ● GEB for E2e tests
  • 4.
  • 5.
  • 6.
  • 7. GEB Geb is a browser automation solution. It brings together the power of WebDriver, the elegance of jQuery content selection, the robustness of Page Object modelling and the expressiveness of the Groovy language.
  • 8. GEB - Page Object and Module Geb implements a Page Object pattern via its Module and Page class (user extends those classes when creating it own) Each Page object is consisted of three main parts: ● Static URL ● Static At ● Static Content Module represents a reusable unit of Page content its structure is: ● Static Content
  • 9. GEB - Page Object
  • 10. GEB - Page Object
  • 11. GEB - Page Object
  • 12. GEB - Page Object
  • 13. GEB - Page Object
  • 14. GEB - Page Object
  • 15. GEB - Page Object and Module
  • 16. GEB - Page Object and Module
  • 17. GEB - JQuery content selection - $()
  • 18. GEB - JQuery content selection - $()
  • 19. GEB - JQuery content selection - $()
  • 20. GEB - JQuery content selection - $()
  • 21. GEB - JQuery content selection - $()
  • 23.
  • 24. How the reality looks like ● Slow ● Unstable ● No standard ● Hard to maintain ○ Refactor ○ To big page objects ○ Developer reluctance ● One repo for everything ● No ownership defined
  • 25. Test Architecture Test Class Controller Page Object View Controller Model Test Class Page Object GEB/Selenium Yeah Pages + Whatever I need + Whatever I need
  • 26. Page Object as Model Only locators and possibilities of how to interact with them
  • 27. Controller Controllers gathers actions available on the page objects in order to perform a business action.
  • 28. Controller Controllers gathers actions available on the page objects in order to perform a business action.
  • 29. Controller Controllers gathers actions available on the page objects in order to perform a business action.
  • 30. Controller Controllers gathers actions available on the page objects in order to perform a business action.
  • 31. Test scenario as a view View uses methods defined in the controller written in high level language. View provides test data
  • 32. WebDriver implementation But we do not have GEB we have got clean selenium… We do not know Groovy...
  • 33. WebDriver implementation If your project is Java based then you might consider use Groovy and Groovy based testing frameworks like GEB and Spock. Groovy is relatively easy for Java developers and it brings to the table lot of magic that decreases test verbosity
  • 34. WebDriver implementation But we still do not want to...
  • 35. WebDriver implementation Then similar effects you can obtain using Page Object pattern, Java 8 default methods in interfaces with combination with fluent style programming.
  • 36. WebDriver implementation - problem Simple test yet it is not visible at the first glance
  • 37. WebDriver implementation - problem Simple test yet it is not visible at the first glance Selectors in a test class..
  • 38. WebDriver implementation - problem Simple test yet it is not visible at the first glance Selectors in a test class.. Test class does everything…
  • 39. WebDriver implementation - problem Simple test yet it is not visible at the first glance Selectors in a test class.. Test class does everything… It slows down reading speed… Increases frustration and most importantly onboarding time of the new less experienced team members
  • 40. WebDriver - What we want! Test written in natural to the user language, configuration and details are abstracted away.
  • 41. WebDriver - How To 1. Create abstract BaseTestClass - this class will hold all driver configuration actions as well as clean up actions 2. Delegate Driver creation to the DriverFactory utility class
  • 42. WebDriver - How To 1. Create abstract BaseTestClass - this class will hold all driver configuration actions as well as clean up actions 2. Delegate Driver creation to the DriverFactory utility class
  • 44. WebDriver - How To -BasePageClass 3. Create abstract BasePageClass that will have common methods ex. $()
  • 45. WebDriver - How To -BasePageClass 3. Create abstract BasePageClass that will have common methods ex. $()
  • 46. WebDriver - How To -BasePageClass 3. Create abstract BasePageClass that will have common methods ex. $()
  • 47. 4. Create Page class that will extend BasePageClass WebDriver - How To -BasePageClass
  • 48. 4. Create Page class that will extend BasePageClass 5. Create locator definitions and methods to operate on them (see that Page do not consist any business logic) WebDriver - How To -BasePageClass
  • 49. 4. Create Page class that will extend BasePageClass 5. Create locator definitions and methods to operate on them (see that Page do not consist any business logic) WebDriver - How To -BasePageClass
  • 50. 4. Create Page class that will extend BasePageClass 5. Create locator definitions and methods to operate on them (see that Page do not consist any business logic) 6. Apply method chaining (it is a one way of fluent style application) WebDriver - How To -BasePageClass
  • 51. 4. Create Page class that will extend BasePageClass 5. Create locator definitions and methods to operate on them (see that Page do not consist any business logic) 6. Apply method chaining (it is a one way of fluent style application) WebDriver - How To -BasePageClass
  • 52. 7. Create Interface that will contain default methods. This methods should gather actions in a chain in order to perform a business logic on the Page. WebDriver - How To - Controllers
  • 53. 7. Create Interface that will contain default methods. This methods should gather actions in a chain in order to perform a business logic on the Page. WebDriver - How To - Controllers
  • 54. 7. Create Interface that will contain default methods. This methods should gather actions in a chain in order to perform a business logic on the Page. WebDriver - How To - Controllers
  • 55. WebDriver - Putting all together
  • 56. Takeaways - Why GEB ● Based on Selenium WebDriver ● Page Object is main focus of the framework ● jQuery style content selection ● Uses Groovy language ● WebDriver is a W3C recommendation ● Easy to start ● Productivity
  • 57. To be honest, good E2E tests can be obtained without GEB… and having a GEB do not ensure well written E2E test as previously saw. Think of the test architecture upfront so you won’t land with a test suite that has to be refactored to the ground Takeaways - Why GEB
  • 58. Takeaways - Writing clear tests ● It helps with test maintainability ● It improves readability by providing human friendly dsl ● It helps with onboarding new team members ● It encourages reusability ● It is easier to debug if we know at which step test failed ● It lives room for new testing approaches.
  • 59. Thank You For Your Attention Q&A?