SlideShare a Scribd company logo
Breaking the Limits of
Page Objects
Robert Bossek
robert.bossek@qualityminds.de
.
Software Architecture
1. Enterprise Architecture
2. Security Architecture
& IAM
3. Application Architecture
Testing Essentials
1. Test Design
2. Test Automation
3. Test Management
4. Test Data
Environments
1. DevOps
2. Oracle
3. Technical Architecture
Agile Testing
1. Test Coaching
2. Construction and
Maintenance of the
Regression Test Suite
3. E2E Test Management
Requirements
Engineering
1. Agile RE
2. RE Essentials
3. Testability
Mobile Testing
1. Mobile Testing Strategy
2. Mobile Test Automation
3. Mobile Experience
Content
Management
System
• commercial CMS tool
• customized features
• individual components
• various configurations
• various combinations
• various user flows
• test framework:
Basic
Selenium
Test
• Selenium methods are accessed
directly from the test case
• Page elements are addressed
directly in the test case
<?php
class LoginCest
{
public function loginTest(SeleniumWebDriver $I)
{
$I->amOnPage('http://www.payback.mx');
$I->fillField(['css' => 'input#cardnumber'], '5010961962');
$I->fillField(['css' => 'input#pin'], '1234');
$I->click(['css' => 'input[type="submit"]']);
$I->see('Welcome');
}
}
Simple
Page
Object
• Page elements shall be
encapsulated in a Page Object
• reusable
• maintainable
<?php
class LoginPage
{
public function getUrl(): string
{
return 'http://www.payback.mx';
}
public function getCardnumberField(): array
{
return ['css' => 'input#cardnumber'];
}
public function getPinField(): array
{
return ['css' => 'input#pin'];
}
public function getLoginButton(): array
{
return ['css' => 'input[type="submit"]'];
}
}
Simple
Page
Object
<?php
class LoginCest
{
public function loginTest(SeleniumWebDriver $I)
{
$loginPage = new LoginPage();
$I->amOnPage($loginPage->getUrl());
$I->fillField($loginPage->getCardnumberField(), '5010961962');
$I->fillField($loginPage->getPinField(), '1234');
$I->click($loginPage->getLoginButton());
$I->see('Welcome');
}
public function tryToLoginWithWrongPinTest(SeleniumWebDriver $I)
{
$loginPage = new LoginPage();
$I->amOnPage($loginPage->getUrl());
$I->fillField($loginPage->getCardnumberField(), '5010961962');
$I->fillField($loginPage->getPinField(), ‘4321');
$I->click($loginPage->getLoginButton());
$I->dontSee('Welcome');
}
}
• Page elements shall be
encapsulated in a Page Object
• reusable
• maintainable
• Selenium methods are still
accessed directly from the test
case
Simple
Page
Object
<?php
class LoginCest
{
public function loginTest(SeleniumWebDriver $I)
{
$loginPage = new LoginPage();
$I->amOnPage($loginPage->getUrl());
$I->click($loginPage->getEmailToggle());
$I->waitForElementVisible($loginPage->getCardnumberToggle());
$I->fillField($loginPage->getEmailField(), ‘user42@test.it');
$I->fillField($loginPage->getPinField(), '1234');
$I->click($loginPage->getLoginButton());
$I->see('Welcome');
}
...
}
• individual special case handling
directly in test case
• danger of
• code duplication
• differing/unstable handling
• losing business case focus
Advanced
Page
Object
<?php
class LoginPage
{
private $webDriver;
public function __construct(SeleniumWebDriver $webDriver)
{
$this->webDriver = $webDriver;
}
public function toggleToEmail()
{
$I = this->webDriver;
$I->click($this->getEmailToggle());
$I->waitForElementNotVisible($this->getEmailToggle());
$I->waitForElementVisible($this->getCardnumberToggle());
}
public function toggleToCardnumber()
{
$I = this->webDriver;
$I->click($this->getCardnumberToggle());
$I->waitForElementNotVisible($this->getCardnumberToggle());
$I->waitForElementVisible($this->getEmailToggle());
}
...
• Selenium methods shall also be
encapsulated in the Page Object
• single source of responsibility
• higher stability
• test driver must be passed
to the Page Object
Advanced
Page
Object
...
public function fillCardnumberField(string $cardnumber) { ... }
public function fillEmailField(string $email) { ... }
public function fillPinField(string $pin) { ... }
public function clickLoginButton() { ... }
public function loadPage() { ... }
private function getUrl(): string { ... }
private function getCardnumberField(): array { ... }
private function getEmailField(): array { ... }
private function getPinField(): array { ... }
private function getLoginButton(): array { ... }
private function getCardnumberToggle(): array { ... }
private function getEmailToggle(): array { ... }
}
• Selenium methods shall also be
encapsulated in the Page Object
• single source of responsibility
• higher stability
• test driver must be passed
to the Page Object
• Page elements are hidden
in the Page Object
• prevents inproper usage
• maintainable
Advanced
Page
Object
<?php
class LoginCest
{
public function loginTest(SeleniumWebDriver $I)
{
$loginPage = new LoginPage($I);
$loginPage->loadPage();
$loginPage->toggleToEmail();
$loginPage->fillEmailField('user42@test.it');
$loginPage->fillPinField('1234');
$loginPage->clickLoginButton();
$I->see('Welcome');
}
}
• Selenium methods shall also be
encapsulated in the Page Object
• single source of responsibility
• higher stability
• test driver must be passed
to the Page Object
• Page elements are hidden
in the Page Object
• prevents inproper usage
• maintainable
• increases readability
• puts focus on business case
Breaking
the
Limits
<?php
class LoginSection
{
private $webDriver;
private $cssContext;
public function __construct(
SeleniumWebDriver $webDriver, string $cssContext
) {
$this->webDriver = $webDriver;
$this->cssContext = $cssContext;
}
public function fillCardnumberField(string $cardnumber) { ... }
public function fillEmailField(string $email) { ... }
public function fillPinField(string $pin ) { ... }
public function toggleToEmail() { ... }
public function toggleToCardnumber() { ... }
public function clickLoginButton() { ... }
...
• create separate representations of
section, so-called Section Object
• add section related methods to the
Section Object
• add section context
...
private function getCardnumberField(): array
{
return ['css' => $this->cssContext . ' input#cardnumber'];
}
private function getEmailField(): array
{
return ['css' => $this->cssContext . ' input#email'];
}
private function getPinField(): array
{
return ['css' => $this->cssContext . ' input#pin'];
}
private function getLoginButton(): array
{
return ['css' => $this->cssContext . ' input[type="submit"]'];
}
}
Breaking
the
Limits
• create separate representations of
section, so-called Section Objects
• add section related methods to the
Section Object
• add section context to
• increase accuracy
• induce generic reusability
<?php
class LoginPage
{
private $webDriver;
public function __construct(SeleniumWebDriver $webDriver)
{
$this->webDriver = $webDriver;
}
public function loadPage()
{
$this->webDriver->amOnPage($this->getUrl());
}
private function getUrl(): string
{
return 'http://www.payback.mx';
}
...
Breaking
the
Limits
• create separate representations of
section, so-called Section Objects
• add section related methods to the
Section Object
• add section context to
• increase accuracy
• induce generic reusability
• Page related methods remain
in the Page Object
...
private $headerNavigation;
private $loginSection;
public function getHeaderNavigation(): HeaderNavigation
{
if ($this->headerNavigation === null) {
$this->headerNavigation = new HeaderNavigation(
$this->webDriver, 'body > nav#pb-navbar');
}
return $this->headerNavigation;
}
public function getLoginSection(): LoginSection
{
if ($this->loginSection === null) {
$this->loginSection = new LoginSection(
$this->webDriver, 'body > div.pb-container_first');
}
return $this->headerNavigation;
}
}
Breaking
the
Limits
• create separate representations of
section, so-called Section Objects
• add section related methods to the
Section Object
• add section context to
• increase accuracy
• induce generic reusability
• Page related methods remain
in the Page Object
• Page Objects serve as Container
for Section Objects
<?php
class LoginCest
{
public function headerLoginTest(SeleniumWebDriver $I)
{
$loginPage = new LoginPage($I);
$loginPage->loadPage();
$inlineLogin = $loginPage->getLoginSection();
$inlineLogin->fillCardnumberField('1111111111');
$inlineLogin->fillPinField('4321');
$headerNavigation = $loginPage->getHeaderNavigation();
$headerNavigation->expandLoginSection();
$headerLogin = $headerNavigation->getLoginSection();
$headerLogin->fillCardnumberField('5010961962');
$headerLogin->fillPinField('1234');
$headerLogin->clickLoginButton();
$I->see('Welcome');
}
}
Breaking
the
Limits
• create separate representations of
section, so-called Section Objects
• add section related methods to the
Section Object
• add section context
• increase accuracy
• induce generic reusability
• Page related methods remain
in the Page Object
• Page Objects serve as Container
for Section Objects
• targeted and parallel usage of the
same section in one test case
Test Case
Page Object
Section Object
Test Driver
CSS Context
1
1
uses
has
uses
*
uses
uses
defines
has
*1
*
*
1
1 1
*
*
1 *
Breaking
the
Limits
<?php
class HeaderNavigation
{
private $webDriver;
private $cssContext;
private $loginSection;
public function __construct(
SeleniumWebDriver $webDriver, string $cssContext
) {
$this->webDriver = $webDriver;
$this->cssContext = $cssContext;
}
public function getLoginSection(): LoginSection
{
if ($this->loginSection === null) {
$this->loginSection = new LoginSection(
$this->webDriver,
$this->cssContext . ' div.pb-nav-login-panel‘
);
}
return $this->headerNavigation;
}
...
• …
• Section Objects can be Containers
for other Section Objects, too
Thank
Y ou
robert.bossek@qualityminds.de
Robert Bossek
Questions?
Robert Bossek
robert.bossek@qualityminds.de

More Related Content

What's hot

Rails Best Practices
Rails Best PracticesRails Best Practices
Rails Best Practices
Icalia Labs
 
AngularJS
AngularJSAngularJS
AngularJS
LearningTech
 
Basics of AngularJS
Basics of AngularJSBasics of AngularJS
Basics of AngularJS
Filip Janevski
 
25 Real Life Tips In Ruby on Rails Development
25 Real Life Tips In Ruby on Rails Development25 Real Life Tips In Ruby on Rails Development
25 Real Life Tips In Ruby on Rails Development
Belighted
 
How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30
fiyuer
 
termUserGroups
termUserGroupstermUserGroups
termUserGroups
Daniel Gilhousen
 
[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법
Jeado Ko
 
Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and Ruby
Ynon Perek
 
Making Magento flying like a rocket! (A set of valuable tips for developers)
Making Magento flying like a rocket! (A set of valuable tips for developers)Making Magento flying like a rocket! (A set of valuable tips for developers)
Making Magento flying like a rocket! (A set of valuable tips for developers)
Ivan Chepurnyi
 
A Peek At The Future: Going Beyond JavaServer Faces 2.0 With RichFaces 4
A Peek At The Future: Going Beyond JavaServer Faces 2.0 With RichFaces 4A Peek At The Future: Going Beyond JavaServer Faces 2.0 With RichFaces 4
A Peek At The Future: Going Beyond JavaServer Faces 2.0 With RichFaces 4
balunasj
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
Oscar Merida
 
Alloy Tips & Tricks #TiLon
Alloy Tips & Tricks #TiLonAlloy Tips & Tricks #TiLon
Alloy Tips & Tricks #TiLon
Fokke Zandbergen
 
Overlays, Accordions & Tabs, Oh My
Overlays, Accordions & Tabs, Oh MyOverlays, Accordions & Tabs, Oh My
Overlays, Accordions & Tabs, Oh My
Steve McMahon
 
AtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-onsAtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-ons
Atlassian
 
实战Ecos
实战Ecos实战Ecos
实战Ecos
wanglei999
 
AngularJS.part1
AngularJS.part1AngularJS.part1
AngularJS.part1
Andrey Kolodnitsky
 
JavaScript
JavaScriptJavaScript
JavaScript
Sunil OS
 
WinAppDriver - Windows Store Apps Test Automation
WinAppDriver - Windows Store Apps Test AutomationWinAppDriver - Windows Store Apps Test Automation
WinAppDriver - Windows Store Apps Test Automation
Jeremy Kao
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
EPAM Systems
 
AtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using nowAtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using now
Atlassian
 

What's hot (20)

Rails Best Practices
Rails Best PracticesRails Best Practices
Rails Best Practices
 
AngularJS
AngularJSAngularJS
AngularJS
 
Basics of AngularJS
Basics of AngularJSBasics of AngularJS
Basics of AngularJS
 
25 Real Life Tips In Ruby on Rails Development
25 Real Life Tips In Ruby on Rails Development25 Real Life Tips In Ruby on Rails Development
25 Real Life Tips In Ruby on Rails Development
 
How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30
 
termUserGroups
termUserGroupstermUserGroups
termUserGroups
 
[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법
 
Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and Ruby
 
Making Magento flying like a rocket! (A set of valuable tips for developers)
Making Magento flying like a rocket! (A set of valuable tips for developers)Making Magento flying like a rocket! (A set of valuable tips for developers)
Making Magento flying like a rocket! (A set of valuable tips for developers)
 
A Peek At The Future: Going Beyond JavaServer Faces 2.0 With RichFaces 4
A Peek At The Future: Going Beyond JavaServer Faces 2.0 With RichFaces 4A Peek At The Future: Going Beyond JavaServer Faces 2.0 With RichFaces 4
A Peek At The Future: Going Beyond JavaServer Faces 2.0 With RichFaces 4
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
Alloy Tips & Tricks #TiLon
Alloy Tips & Tricks #TiLonAlloy Tips & Tricks #TiLon
Alloy Tips & Tricks #TiLon
 
Overlays, Accordions & Tabs, Oh My
Overlays, Accordions & Tabs, Oh MyOverlays, Accordions & Tabs, Oh My
Overlays, Accordions & Tabs, Oh My
 
AtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-onsAtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-ons
 
实战Ecos
实战Ecos实战Ecos
实战Ecos
 
AngularJS.part1
AngularJS.part1AngularJS.part1
AngularJS.part1
 
JavaScript
JavaScriptJavaScript
JavaScript
 
WinAppDriver - Windows Store Apps Test Automation
WinAppDriver - Windows Store Apps Test AutomationWinAppDriver - Windows Store Apps Test Automation
WinAppDriver - Windows Store Apps Test Automation
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
AtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using nowAtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using now
 

Similar to Breaking the limits_of_page_objects

Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
SPTechCon
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Roy de Kleijn
 
Wix Automation - Core
Wix Automation - CoreWix Automation - Core
Wix Automation - Core
Efrat Attas
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Sean Burgess
 
Better Testing With PHP Unit
Better Testing With PHP UnitBetter Testing With PHP Unit
Better Testing With PHP Unit
sitecrafting
 
Web driver training
Web driver trainingWeb driver training
Web driver training
Dipesh Bhatewara
 
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
 
J query module1
J query module1J query module1
J query module1
Srivatsan Krishnamachari
 
2010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-62010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-6
Marakana Inc.
 
Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6
Marakana Inc.
 
Selenium再入門
Selenium再入門Selenium再入門
Selenium再入門
Norio Suzuki
 
Selenium training
Selenium trainingSelenium training
Selenium training
Suresh Arora
 
A test framework out of the box - Geb for Web and mobile
A test framework out of the box - Geb for Web and mobileA test framework out of the box - Geb for Web and mobile
A test framework out of the box - Geb for Web and mobile
GlobalLogic Ukraine
 
Advanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentAdvanced SharePoint Web Part Development
Advanced SharePoint Web Part Development
Rob Windsor
 
Painless Persistence in a Disconnected World
Painless Persistence in a Disconnected WorldPainless Persistence in a Disconnected World
Painless Persistence in a Disconnected World
Christian Melchior
 
Javascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSJavascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JS
Min Ming Lo
 
Surviving UI Automation Armageddon with BELLATRIX.pptx
Surviving UI Automation Armageddon with BELLATRIX.pptxSurviving UI Automation Armageddon with BELLATRIX.pptx
Surviving UI Automation Armageddon with BELLATRIX.pptx
NikolayAvramov4
 
Real World MVC
Real World MVCReal World MVC
Real World MVC
James Johnson
 
Codeinator
CodeinatorCodeinator
OSCON 2005: Build Your Own Chandler Parcel
OSCON 2005: Build Your Own Chandler ParcelOSCON 2005: Build Your Own Chandler Parcel
OSCON 2005: Build Your Own Chandler Parcel
Ted Leung
 

Similar to Breaking the limits_of_page_objects (20)

Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
 
Wix Automation - Core
Wix Automation - CoreWix Automation - Core
Wix Automation - Core
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
 
Better Testing With PHP Unit
Better Testing With PHP UnitBetter Testing With PHP Unit
Better Testing With PHP Unit
 
Web driver training
Web driver trainingWeb driver training
Web driver training
 
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
 
J query module1
J query module1J query module1
J query module1
 
2010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-62010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-6
 
Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6
 
Selenium再入門
Selenium再入門Selenium再入門
Selenium再入門
 
Selenium training
Selenium trainingSelenium training
Selenium training
 
A test framework out of the box - Geb for Web and mobile
A test framework out of the box - Geb for Web and mobileA test framework out of the box - Geb for Web and mobile
A test framework out of the box - Geb for Web and mobile
 
Advanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentAdvanced SharePoint Web Part Development
Advanced SharePoint Web Part Development
 
Painless Persistence in a Disconnected World
Painless Persistence in a Disconnected WorldPainless Persistence in a Disconnected World
Painless Persistence in a Disconnected World
 
Javascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSJavascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JS
 
Surviving UI Automation Armageddon with BELLATRIX.pptx
Surviving UI Automation Armageddon with BELLATRIX.pptxSurviving UI Automation Armageddon with BELLATRIX.pptx
Surviving UI Automation Armageddon with BELLATRIX.pptx
 
Real World MVC
Real World MVCReal World MVC
Real World MVC
 
Codeinator
CodeinatorCodeinator
Codeinator
 
OSCON 2005: Build Your Own Chandler Parcel
OSCON 2005: Build Your Own Chandler ParcelOSCON 2005: Build Your Own Chandler Parcel
OSCON 2005: Build Your Own Chandler Parcel
 

Recently uploaded

The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
Yara Milbes
 
Kubernetes at Scale: Going Multi-Cluster with Istio
Kubernetes at Scale:  Going Multi-Cluster  with IstioKubernetes at Scale:  Going Multi-Cluster  with Istio
Kubernetes at Scale: Going Multi-Cluster with Istio
Severalnines
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
sandeepmenon62
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
Tier1 app
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
sjcobrien
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio, Inc.
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
What’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete RoadmapWhat’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete Roadmap
Envertis Software Solutions
 
TMU毕业证书精仿办理
TMU毕业证书精仿办理TMU毕业证书精仿办理
TMU毕业证书精仿办理
aeeva
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Paul Brebner
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
kalichargn70th171
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 

Recently uploaded (20)

The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
 
Kubernetes at Scale: Going Multi-Cluster with Istio
Kubernetes at Scale:  Going Multi-Cluster  with IstioKubernetes at Scale:  Going Multi-Cluster  with Istio
Kubernetes at Scale: Going Multi-Cluster with Istio
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
What’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete RoadmapWhat’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete Roadmap
 
TMU毕业证书精仿办理
TMU毕业证书精仿办理TMU毕业证书精仿办理
TMU毕业证书精仿办理
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 

Breaking the limits_of_page_objects

  • 1. Breaking the Limits of Page Objects Robert Bossek robert.bossek@qualityminds.de
  • 2. . Software Architecture 1. Enterprise Architecture 2. Security Architecture & IAM 3. Application Architecture Testing Essentials 1. Test Design 2. Test Automation 3. Test Management 4. Test Data Environments 1. DevOps 2. Oracle 3. Technical Architecture Agile Testing 1. Test Coaching 2. Construction and Maintenance of the Regression Test Suite 3. E2E Test Management Requirements Engineering 1. Agile RE 2. RE Essentials 3. Testability Mobile Testing 1. Mobile Testing Strategy 2. Mobile Test Automation 3. Mobile Experience
  • 3. Content Management System • commercial CMS tool • customized features • individual components • various configurations • various combinations • various user flows • test framework:
  • 4.
  • 5. Basic Selenium Test • Selenium methods are accessed directly from the test case • Page elements are addressed directly in the test case <?php class LoginCest { public function loginTest(SeleniumWebDriver $I) { $I->amOnPage('http://www.payback.mx'); $I->fillField(['css' => 'input#cardnumber'], '5010961962'); $I->fillField(['css' => 'input#pin'], '1234'); $I->click(['css' => 'input[type="submit"]']); $I->see('Welcome'); } }
  • 6.
  • 7.
  • 8. Simple Page Object • Page elements shall be encapsulated in a Page Object • reusable • maintainable <?php class LoginPage { public function getUrl(): string { return 'http://www.payback.mx'; } public function getCardnumberField(): array { return ['css' => 'input#cardnumber']; } public function getPinField(): array { return ['css' => 'input#pin']; } public function getLoginButton(): array { return ['css' => 'input[type="submit"]']; } }
  • 9. Simple Page Object <?php class LoginCest { public function loginTest(SeleniumWebDriver $I) { $loginPage = new LoginPage(); $I->amOnPage($loginPage->getUrl()); $I->fillField($loginPage->getCardnumberField(), '5010961962'); $I->fillField($loginPage->getPinField(), '1234'); $I->click($loginPage->getLoginButton()); $I->see('Welcome'); } public function tryToLoginWithWrongPinTest(SeleniumWebDriver $I) { $loginPage = new LoginPage(); $I->amOnPage($loginPage->getUrl()); $I->fillField($loginPage->getCardnumberField(), '5010961962'); $I->fillField($loginPage->getPinField(), ‘4321'); $I->click($loginPage->getLoginButton()); $I->dontSee('Welcome'); } } • Page elements shall be encapsulated in a Page Object • reusable • maintainable • Selenium methods are still accessed directly from the test case
  • 10.
  • 11. Simple Page Object <?php class LoginCest { public function loginTest(SeleniumWebDriver $I) { $loginPage = new LoginPage(); $I->amOnPage($loginPage->getUrl()); $I->click($loginPage->getEmailToggle()); $I->waitForElementVisible($loginPage->getCardnumberToggle()); $I->fillField($loginPage->getEmailField(), ‘user42@test.it'); $I->fillField($loginPage->getPinField(), '1234'); $I->click($loginPage->getLoginButton()); $I->see('Welcome'); } ... } • individual special case handling directly in test case • danger of • code duplication • differing/unstable handling • losing business case focus
  • 12.
  • 13.
  • 14. Advanced Page Object <?php class LoginPage { private $webDriver; public function __construct(SeleniumWebDriver $webDriver) { $this->webDriver = $webDriver; } public function toggleToEmail() { $I = this->webDriver; $I->click($this->getEmailToggle()); $I->waitForElementNotVisible($this->getEmailToggle()); $I->waitForElementVisible($this->getCardnumberToggle()); } public function toggleToCardnumber() { $I = this->webDriver; $I->click($this->getCardnumberToggle()); $I->waitForElementNotVisible($this->getCardnumberToggle()); $I->waitForElementVisible($this->getEmailToggle()); } ... • Selenium methods shall also be encapsulated in the Page Object • single source of responsibility • higher stability • test driver must be passed to the Page Object
  • 15. Advanced Page Object ... public function fillCardnumberField(string $cardnumber) { ... } public function fillEmailField(string $email) { ... } public function fillPinField(string $pin) { ... } public function clickLoginButton() { ... } public function loadPage() { ... } private function getUrl(): string { ... } private function getCardnumberField(): array { ... } private function getEmailField(): array { ... } private function getPinField(): array { ... } private function getLoginButton(): array { ... } private function getCardnumberToggle(): array { ... } private function getEmailToggle(): array { ... } } • Selenium methods shall also be encapsulated in the Page Object • single source of responsibility • higher stability • test driver must be passed to the Page Object • Page elements are hidden in the Page Object • prevents inproper usage • maintainable
  • 16. Advanced Page Object <?php class LoginCest { public function loginTest(SeleniumWebDriver $I) { $loginPage = new LoginPage($I); $loginPage->loadPage(); $loginPage->toggleToEmail(); $loginPage->fillEmailField('user42@test.it'); $loginPage->fillPinField('1234'); $loginPage->clickLoginButton(); $I->see('Welcome'); } } • Selenium methods shall also be encapsulated in the Page Object • single source of responsibility • higher stability • test driver must be passed to the Page Object • Page elements are hidden in the Page Object • prevents inproper usage • maintainable • increases readability • puts focus on business case
  • 17.
  • 18.
  • 19.
  • 20.
  • 21. Breaking the Limits <?php class LoginSection { private $webDriver; private $cssContext; public function __construct( SeleniumWebDriver $webDriver, string $cssContext ) { $this->webDriver = $webDriver; $this->cssContext = $cssContext; } public function fillCardnumberField(string $cardnumber) { ... } public function fillEmailField(string $email) { ... } public function fillPinField(string $pin ) { ... } public function toggleToEmail() { ... } public function toggleToCardnumber() { ... } public function clickLoginButton() { ... } ... • create separate representations of section, so-called Section Object • add section related methods to the Section Object • add section context
  • 22. ... private function getCardnumberField(): array { return ['css' => $this->cssContext . ' input#cardnumber']; } private function getEmailField(): array { return ['css' => $this->cssContext . ' input#email']; } private function getPinField(): array { return ['css' => $this->cssContext . ' input#pin']; } private function getLoginButton(): array { return ['css' => $this->cssContext . ' input[type="submit"]']; } } Breaking the Limits • create separate representations of section, so-called Section Objects • add section related methods to the Section Object • add section context to • increase accuracy • induce generic reusability
  • 23. <?php class LoginPage { private $webDriver; public function __construct(SeleniumWebDriver $webDriver) { $this->webDriver = $webDriver; } public function loadPage() { $this->webDriver->amOnPage($this->getUrl()); } private function getUrl(): string { return 'http://www.payback.mx'; } ... Breaking the Limits • create separate representations of section, so-called Section Objects • add section related methods to the Section Object • add section context to • increase accuracy • induce generic reusability • Page related methods remain in the Page Object
  • 24. ... private $headerNavigation; private $loginSection; public function getHeaderNavigation(): HeaderNavigation { if ($this->headerNavigation === null) { $this->headerNavigation = new HeaderNavigation( $this->webDriver, 'body > nav#pb-navbar'); } return $this->headerNavigation; } public function getLoginSection(): LoginSection { if ($this->loginSection === null) { $this->loginSection = new LoginSection( $this->webDriver, 'body > div.pb-container_first'); } return $this->headerNavigation; } } Breaking the Limits • create separate representations of section, so-called Section Objects • add section related methods to the Section Object • add section context to • increase accuracy • induce generic reusability • Page related methods remain in the Page Object • Page Objects serve as Container for Section Objects
  • 25. <?php class LoginCest { public function headerLoginTest(SeleniumWebDriver $I) { $loginPage = new LoginPage($I); $loginPage->loadPage(); $inlineLogin = $loginPage->getLoginSection(); $inlineLogin->fillCardnumberField('1111111111'); $inlineLogin->fillPinField('4321'); $headerNavigation = $loginPage->getHeaderNavigation(); $headerNavigation->expandLoginSection(); $headerLogin = $headerNavigation->getLoginSection(); $headerLogin->fillCardnumberField('5010961962'); $headerLogin->fillPinField('1234'); $headerLogin->clickLoginButton(); $I->see('Welcome'); } } Breaking the Limits • create separate representations of section, so-called Section Objects • add section related methods to the Section Object • add section context • increase accuracy • induce generic reusability • Page related methods remain in the Page Object • Page Objects serve as Container for Section Objects • targeted and parallel usage of the same section in one test case
  • 26. Test Case Page Object Section Object Test Driver CSS Context 1 1 uses has uses * uses uses defines has *1 * * 1 1 1 * * 1 *
  • 27. Breaking the Limits <?php class HeaderNavigation { private $webDriver; private $cssContext; private $loginSection; public function __construct( SeleniumWebDriver $webDriver, string $cssContext ) { $this->webDriver = $webDriver; $this->cssContext = $cssContext; } public function getLoginSection(): LoginSection { if ($this->loginSection === null) { $this->loginSection = new LoginSection( $this->webDriver, $this->cssContext . ' div.pb-nav-login-panel‘ ); } return $this->headerNavigation; } ... • … • Section Objects can be Containers for other Section Objects, too