SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

Rails Best Practices
Rails Best PracticesRails Best Practices
Rails Best PracticesIcalia Labs
 
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
 
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
 

Was ist angesagt? (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
 

Ähnlich wie 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
 
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.
 
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.
 
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
 
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
 

Ähnlich wie 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
 
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
 
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
 
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
 

Kürzlich hochgeladen

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 PrecisionSolGuruz
 
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 ...harshavardhanraghave
 
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...MyIntelliSource, Inc.
 
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...kellynguyen01
 
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 Modelsaagamshah0812
 
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.comFatema Valibhai
 
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.pdfkalichargn70th171
 
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-...Steffen Staab
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
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.docxComplianceQuest1
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
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 ...MyIntelliSource, Inc.
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
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.jsAndolasoft Inc
 
+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
 
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
 
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...ICS
 

Kürzlich hochgeladen (20)

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
 
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...
 
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
 
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
 
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
 
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-...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
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
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
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 ...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
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
 
+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...
 
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
 
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...
 

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