SlideShare uma empresa Scribd logo
1 de 29
Baixar para ler offline
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

Mais conteĂşdo relacionado

Mais procurados

Rails Best Practices
Rails Best PracticesRails Best Practices
Rails Best PracticesIcalia Labs
 
Basics of AngularJS
Basics of AngularJSBasics of AngularJS
Basics of AngularJSFilip 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 DevelopmentBelighted
 
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 30fiyuer
 
[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 RubyYnon 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 4balunasj
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPOscar Merida
 
Alloy Tips & Tricks #TiLon
Alloy Tips & Tricks #TiLonAlloy Tips & Tricks #TiLon
Alloy Tips & Tricks #TiLonFokke Zandbergen
 
Overlays, Accordions & Tabs, Oh My
Overlays, Accordions & Tabs, Oh MyOverlays, Accordions & Tabs, Oh My
Overlays, Accordions & Tabs, Oh MySteve 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-onsAtlassian
 
实战Ecos
实战Ecos实战Ecos
实战Ecoswanglei999
 
JavaScript
JavaScriptJavaScript
JavaScriptSunil OS
 
WinAppDriver - Windows Store Apps Test Automation
WinAppDriver - Windows Store Apps Test AutomationWinAppDriver - Windows Store Apps Test Automation
WinAppDriver - Windows Store Apps Test AutomationJeremy 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 BasicsEPAM 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 nowAtlassian
 

Mais procurados (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
 

Semelhante a 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_2016Roy de Kleijn
 
Wix Automation - Core
Wix Automation - CoreWix Automation - Core
Wix Automation - CoreEfrat 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 CombinationSean Burgess
 
Better Testing With PHP Unit
Better Testing With PHP UnitBetter Testing With PHP Unit
Better Testing With PHP Unitsitecrafting
 
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 testingdrewz lin
 
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-6Marakana 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 6Marakana Inc.
 
Selenium再入門
Selenium再入門Selenium再入門
Selenium再入門Norio Suzuki
 
Selenium training
Selenium trainingSelenium training
Selenium trainingSuresh 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 mobileGlobalLogic Ukraine
 
Advanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentAdvanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentRob Windsor
 
Painless Persistence in a Disconnected World
Painless Persistence in a Disconnected WorldPainless Persistence in a Disconnected World
Painless Persistence in a Disconnected WorldChristian Melchior
 
Javascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSJavascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSMin 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.pptxNikolayAvramov4
 
Real World MVC
Real World MVCReal World MVC
Real World MVCJames Johnson
 
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 ParcelTed Leung
 

Semelhante a 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
 

Último

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile EnvironmentVictorSzoltysek
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
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 GoalsJhone kinadey
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 

Último (20)

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
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
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 

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