SlideShare a Scribd company logo
1 of 18
Selenium
Selenium Testing
A t A g i l e S p e e d
D . H a r r i s o n M a y , 2 0 1 9
1 6 P a g e s
Selenium
Selenium Testing
A t A g i l e S p e e d
Over the past few years the role of Selenium testing in project quality
assurance processes has changed. Its role has arguably tracked the
increasing dominance of online and mobile applications in the way in
which business reaches out to its customers and collaborators.
In addition to this trend, the use of agile development processes in
bringing such software applications to life, has become widespread.
This has had a profound effect on how the testing and quality
assurance processes proceed in order to deliver maximum business
value in such projects. Scoping testing to two- or three-week sprint
cycles and synchronizing with how the application parts are being
delivered, has brought quite some challenges.
And then we see the rise of Cloud and DevOps…
2
Selenium
Selenium Testing
A t A g i l e S p e e d
The role of manual testing has dramatically reduced in favour of
automated testing processes, processes that scale into continuous
build & deployment processes - DevOps activities.
How can a project effectively align its testing processes to its agile
development processes? Here we show a strategy that brings
Selenium-based testing of web applications into alignment with such
processes. The architecture described attempts to maximise the
following key metrics:
• Scalability
• Maintainability
• Accessibility
• Assertiveness
3
Selenium
The
Architecture
G e t t i n g R e a l
4
Selenium
Selenium Testing
A t A g i l e S p e e d
As an example, we showcase the test automation pattern by testing
the public web site (Lufthansa). It should be remarked here how this
site, being tested external to the Lufthansa organisation, reacts in the
following way to being driven by a test automation tool:
• If we move “too fast” through a testing workflow, then the site
detects that it is being driven by a “robot” and displays a generic
page content
• If we click on the various links on the main landing page, for
example, in the page footer, then a generic Captcha page content is
displayed. This effectively blocks test automation.
The main landing page of (Lufthansa), when browsing as a real user, is
shown as follows (as of September 2018)
5
Selenium 6
From the right-hand scroll bar, the overall content extends well beyond the current browser vertical dimension. Manually
scrolling to the end of the Strip Page, we see as follows:
Selenium 7
Compare this to what is seen when the site is driven by Selenium-based test automation code, the landing page looks as
following:
Selenium 8
Now we see a very different layout of elements – a “header” offering travel deals (requiring user interaction) as well as a
footer which requests the user to agree to cookie usage on the site (perhaps because of the recent European GDPR
regulations). Using Selenium to move to end of the Tab Strip, we see as follows:
Selenium 9
Now visible is a different “footer” apparently offering buttons to go fast-track to searching flights and price comparison
functionality offered on the site. Note that on this new footer there is a dismiss control, the ‘x’ at the top right of the panel.
If we should dismiss this panel, then we would see:
Selenium 10
It is only now we see the links to very important legal information to which the user of the site is agreeing to as part of a
(flight/hotel/car) booking - (Data Protection), (Terms & Conditions), (Passenger rights) and (Terms of use).
Selenium
Selenium Testing
P a g e O b j e c t G e n e r a t i o n
• The solution presented here uses a project XML
metadata file used to drive the generation of Page
Object code. The tool used to perform this generation
is (Se34) which can produce code in either C# or Java.
The Page Object classes thus generated are fully
finished in that they contain code to validate the items
specified in the XML metadata as well as methods to
perform appropriate operations on entities. For this
example, we use the C# option.
• A fragment of the metadata file is as shown following:
11
Selenium 12
This XML metadata file, is used to generate page-specific code to perform, among other things, the following:
• Validate all the specified page elements in an entity-specific way (“form”) given a specified locator style, e.g. “XPath”
• Perform actions such as Click, SelectByText etc.
• Perform a group of actions on a page defined by name, e.g. “EnterLoginCredentials”
• Allow the test code to address data shown in Tables in a natural object-oriented way
D . H a r r i s o n M a y , 2 0 1 9
D . H a r r i s o n M a y , 2 0 1 9
Selenium 13
As part of the generation process (optionally) property files are generated that contain the text to be validated, for each
page and each spoken language variant.
D . H a r r i s o n M a y , 2 0 1 9
Selenium 14
Above is a fragment of a unit test in Visual Studio/C# which performs some scrolling and basic validations. You can see that
Selenium data is absent as well as the actual text data being validated -> clean tests
D . H a r r i s o n M a y , 2 0 1 9
Selenium 15
Separation of Concerns
D . H a r r i s o n M a y , 2 0 1 9
UnitTestFrmwk
SeleniumFrmwk
Page Objects
Just code -
no data, no
tests
Validation Data
Just data -
no code, no
tests
Unit Tests
Only PO objects, no
validation data
App
Selenium
Selenium Testing
P a g e O b j e c t G e n e r a t i o n
• Clean architectural solution
• Tests can be structured to facilitate walk-throughs with
business actors
• Expanding the set of tests can be estimated with
confidence
• Tests can be designed within the context of agile
sprints (stories, story points) – maximise velocity
• Changes in Pages can be readily accommodated –
update metadata, generate (approach embraces early
days testing on a project)
• General technology lends itself to running the tests is
a cloud DevOps pipeline, e.g. Azure
16
Selenium
Selenium Testing
P a g e O b j e c t G e n e r a t i o n
• Scalability – straightforward process to develop new
tests. Easy to generate new Page Objects to expand
coverage or “maintain” existing ones
• Maintainability – Unit tests easy to maintain. Page
metadata easy to maintain. All code and generation
metadata file can be persisted in Git
• Accessibility – unit tests are “standard” so a developer
with “general” skill level can maintain. Page object
generation can be done by a general project person
• Assertiveness – the Page metadata allows for a range
of comparisons to be made- starts with, ends with,
regex, full etc.
17
Selenium
THANK YOU
h t t p s : / / w w w . d h a r r i s o n c h . c o m
/
D av i d H a r r i s o n
+ 4 1 ( 7 9 ) 1 7 6 ‐ 8 9 8 0
d h a r r i s o n _ c h @ y a h o o . c o . u k

More Related Content

What's hot

Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
shreyas JC
 
Getting started with_testcomplete
Getting started with_testcompleteGetting started with_testcomplete
Getting started with_testcomplete
ankit.das
 
wp-25tips-oltscripts-2287467
wp-25tips-oltscripts-2287467wp-25tips-oltscripts-2287467
wp-25tips-oltscripts-2287467
Yutaka Takatsu
 

What's hot (19)

SOAPUI Test Design & Utilities
SOAPUI Test Design & UtilitiesSOAPUI Test Design & Utilities
SOAPUI Test Design & Utilities
 
Automation Testing with TestComplete
Automation Testing with TestCompleteAutomation Testing with TestComplete
Automation Testing with TestComplete
 
Selenium Testing Training in Bangalore
Selenium Testing Training in BangaloreSelenium Testing Training in Bangalore
Selenium Testing Training in Bangalore
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
 
From Good to Great: Functional and Acceptance Testing in WordPress.
From Good to Great: Functional and Acceptance Testing in WordPress.From Good to Great: Functional and Acceptance Testing in WordPress.
From Good to Great: Functional and Acceptance Testing in WordPress.
 
Test Complete
Test CompleteTest Complete
Test Complete
 
TestComplete – A Sophisticated Automated Testing Tool by SmartBear
TestComplete – A Sophisticated Automated Testing Tool by SmartBearTestComplete – A Sophisticated Automated Testing Tool by SmartBear
TestComplete – A Sophisticated Automated Testing Tool by SmartBear
 
Data driven testing
Data driven testingData driven testing
Data driven testing
 
Github plugin setup in anypointstudio
Github plugin setup in anypointstudioGithub plugin setup in anypointstudio
Github plugin setup in anypointstudio
 
How to Configure Selenium WebDriver (java)
How to Configure Selenium WebDriver (java)How to Configure Selenium WebDriver (java)
How to Configure Selenium WebDriver (java)
 
Configuring Anypoint Studio MQ connector
Configuring Anypoint Studio MQ connectorConfiguring Anypoint Studio MQ connector
Configuring Anypoint Studio MQ connector
 
Getting started with_testcomplete
Getting started with_testcompleteGetting started with_testcomplete
Getting started with_testcomplete
 
Testing_with_TestComplete
Testing_with_TestCompleteTesting_with_TestComplete
Testing_with_TestComplete
 
wp-25tips-oltscripts-2287467
wp-25tips-oltscripts-2287467wp-25tips-oltscripts-2287467
wp-25tips-oltscripts-2287467
 
OPEN STA
OPEN STAOPEN STA
OPEN STA
 
Test Pyramid vs Roi
Test Pyramid vs Roi Test Pyramid vs Roi
Test Pyramid vs Roi
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Mule Integration with Dropbox
Mule Integration with DropboxMule Integration with Dropbox
Mule Integration with Dropbox
 
Aspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_csAspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_cs
 

Similar to Selenium Testing @ Agile Speed

Selenium - The Way Of Success
Selenium - The Way Of SuccessSelenium - The Way Of Success
Selenium - The Way Of Success
Zbyszek Mockun
 
BDD approach with Selenium RC
BDD approach with Selenium RCBDD approach with Selenium RC
BDD approach with Selenium RC
Mykola Kolisnyk
 
2013 10-10 selenium presentation to ocjug
2013 10-10 selenium presentation to ocjug2013 10-10 selenium presentation to ocjug
2013 10-10 selenium presentation to ocjug
Philip Schlesinger
 
What is Selenium Testing.pdf
What is Selenium Testing.pdfWhat is Selenium Testing.pdf
What is Selenium Testing.pdf
AnanthReddy38
 

Similar to Selenium Testing @ Agile Speed (20)

Web Testen mit Selenium
Web Testen mit SeleniumWeb Testen mit Selenium
Web Testen mit Selenium
 
Selenium - The Way Of Success
Selenium - The Way Of SuccessSelenium - The Way Of Success
Selenium - The Way Of Success
 
Selenium
SeleniumSelenium
Selenium
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
 
BDD approach with Selenium RC
BDD approach with Selenium RCBDD approach with Selenium RC
BDD approach with Selenium RC
 
2013 10-10 selenium presentation to ocjug
2013 10-10 selenium presentation to ocjug2013 10-10 selenium presentation to ocjug
2013 10-10 selenium presentation to ocjug
 
International journal of applied sciences and innovation vol 2015 - no 1 - ...
International journal of applied sciences and innovation   vol 2015 - no 1 - ...International journal of applied sciences and innovation   vol 2015 - no 1 - ...
International journal of applied sciences and innovation vol 2015 - no 1 - ...
 
Selenium Best Practices For Web Testing
Selenium Best Practices For Web TestingSelenium Best Practices For Web Testing
Selenium Best Practices For Web Testing
 
Selenium and JMeter Testing
Selenium and JMeter TestingSelenium and JMeter Testing
Selenium and JMeter Testing
 
Selenium and JMeter
Selenium and JMeterSelenium and JMeter
Selenium and JMeter
 
Ijetcas14 413
Ijetcas14 413Ijetcas14 413
Ijetcas14 413
 
7.pdf
7.pdf7.pdf
7.pdf
 
Software Testing Tools Training
Software Testing Tools TrainingSoftware Testing Tools Training
Software Testing Tools Training
 
Selenium-corporate-training-in-mumbai
Selenium-corporate-training-in-mumbaiSelenium-corporate-training-in-mumbai
Selenium-corporate-training-in-mumbai
 
Selenium
SeleniumSelenium
Selenium
 
What is Selenium Testing.pdf
What is Selenium Testing.pdfWhat is Selenium Testing.pdf
What is Selenium Testing.pdf
 
Web Testing
Web TestingWeb Testing
Web Testing
 
Shift left-csun-sagar-barbhaya
Shift left-csun-sagar-barbhayaShift left-csun-sagar-barbhaya
Shift left-csun-sagar-barbhaya
 
Selenium Testing: A Comprehensive Guide to Automated Web Testing
Selenium Testing: A Comprehensive Guide to Automated Web TestingSelenium Testing: A Comprehensive Guide to Automated Web Testing
Selenium Testing: A Comprehensive Guide to Automated Web Testing
 
Web UI Tests: Introduce UI tests using Selenium
Web UI Tests: Introduce UI tests using Selenium Web UI Tests: Introduce UI tests using Selenium
Web UI Tests: Introduce UI tests using Selenium
 

More from David Harrison

More from David Harrison (20)

SchemaStudioTypeLandscape_Article.pdf
SchemaStudioTypeLandscape_Article.pdfSchemaStudioTypeLandscape_Article.pdf
SchemaStudioTypeLandscape_Article.pdf
 
PhoenixRisingArticle.pdf
PhoenixRisingArticle.pdfPhoenixRisingArticle.pdf
PhoenixRisingArticle.pdf
 
IntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdfIntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdf
 
Processor Refactoring.pdf
Processor Refactoring.pdfProcessor Refactoring.pdf
Processor Refactoring.pdf
 
PagesToGo.pdf
PagesToGo.pdfPagesToGo.pdf
PagesToGo.pdf
 
IntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdfIntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdf
 
Generation_XSD_Article - Part 4.pdf
Generation_XSD_Article - Part 4.pdfGeneration_XSD_Article - Part 4.pdf
Generation_XSD_Article - Part 4.pdf
 
PhoenixRisingArticle.pdf
PhoenixRisingArticle.pdfPhoenixRisingArticle.pdf
PhoenixRisingArticle.pdf
 
Generation_XSD_Article - Part 3.pdf
Generation_XSD_Article - Part 3.pdfGeneration_XSD_Article - Part 3.pdf
Generation_XSD_Article - Part 3.pdf
 
Generation_XSD_Article - Part 2.pdf
Generation_XSD_Article - Part 2.pdfGeneration_XSD_Article - Part 2.pdf
Generation_XSD_Article - Part 2.pdf
 
Generation_XSD_Article.docx
Generation_XSD_Article.docxGeneration_XSD_Article.docx
Generation_XSD_Article.docx
 
Test data article
Test data articleTest data article
Test data article
 
Flavours - Classic/Technical BDD
Flavours - Classic/Technical BDDFlavours - Classic/Technical BDD
Flavours - Classic/Technical BDD
 
Babble article - Test Automation & Text Translation
Babble article - Test Automation & Text TranslationBabble article - Test Automation & Text Translation
Babble article - Test Automation & Text Translation
 
Bdd Show and Tell
Bdd Show and TellBdd Show and Tell
Bdd Show and Tell
 
UI Testing Pattern
UI Testing PatternUI Testing Pattern
UI Testing Pattern
 
Soap ui automation
Soap ui automationSoap ui automation
Soap ui automation
 
High sierra part 1
High sierra part 1High sierra part 1
High sierra part 1
 
Workflow Test Automation
Workflow Test AutomationWorkflow Test Automation
Workflow Test Automation
 
Et sensus agile documentation
Et sensus   agile documentationEt sensus   agile documentation
Et sensus agile documentation
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Recently uploaded (20)

Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
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 🔝✔️✔️
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
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
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
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
 
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...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%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
 
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...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
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
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 

Selenium Testing @ Agile Speed

  • 1. Selenium Selenium Testing A t A g i l e S p e e d D . H a r r i s o n M a y , 2 0 1 9 1 6 P a g e s
  • 2. Selenium Selenium Testing A t A g i l e S p e e d Over the past few years the role of Selenium testing in project quality assurance processes has changed. Its role has arguably tracked the increasing dominance of online and mobile applications in the way in which business reaches out to its customers and collaborators. In addition to this trend, the use of agile development processes in bringing such software applications to life, has become widespread. This has had a profound effect on how the testing and quality assurance processes proceed in order to deliver maximum business value in such projects. Scoping testing to two- or three-week sprint cycles and synchronizing with how the application parts are being delivered, has brought quite some challenges. And then we see the rise of Cloud and DevOps… 2
  • 3. Selenium Selenium Testing A t A g i l e S p e e d The role of manual testing has dramatically reduced in favour of automated testing processes, processes that scale into continuous build & deployment processes - DevOps activities. How can a project effectively align its testing processes to its agile development processes? Here we show a strategy that brings Selenium-based testing of web applications into alignment with such processes. The architecture described attempts to maximise the following key metrics: • Scalability • Maintainability • Accessibility • Assertiveness 3
  • 5. Selenium Selenium Testing A t A g i l e S p e e d As an example, we showcase the test automation pattern by testing the public web site (Lufthansa). It should be remarked here how this site, being tested external to the Lufthansa organisation, reacts in the following way to being driven by a test automation tool: • If we move “too fast” through a testing workflow, then the site detects that it is being driven by a “robot” and displays a generic page content • If we click on the various links on the main landing page, for example, in the page footer, then a generic Captcha page content is displayed. This effectively blocks test automation. The main landing page of (Lufthansa), when browsing as a real user, is shown as follows (as of September 2018) 5
  • 6. Selenium 6 From the right-hand scroll bar, the overall content extends well beyond the current browser vertical dimension. Manually scrolling to the end of the Strip Page, we see as follows:
  • 7. Selenium 7 Compare this to what is seen when the site is driven by Selenium-based test automation code, the landing page looks as following:
  • 8. Selenium 8 Now we see a very different layout of elements – a “header” offering travel deals (requiring user interaction) as well as a footer which requests the user to agree to cookie usage on the site (perhaps because of the recent European GDPR regulations). Using Selenium to move to end of the Tab Strip, we see as follows:
  • 9. Selenium 9 Now visible is a different “footer” apparently offering buttons to go fast-track to searching flights and price comparison functionality offered on the site. Note that on this new footer there is a dismiss control, the ‘x’ at the top right of the panel. If we should dismiss this panel, then we would see:
  • 10. Selenium 10 It is only now we see the links to very important legal information to which the user of the site is agreeing to as part of a (flight/hotel/car) booking - (Data Protection), (Terms & Conditions), (Passenger rights) and (Terms of use).
  • 11. Selenium Selenium Testing P a g e O b j e c t G e n e r a t i o n • The solution presented here uses a project XML metadata file used to drive the generation of Page Object code. The tool used to perform this generation is (Se34) which can produce code in either C# or Java. The Page Object classes thus generated are fully finished in that they contain code to validate the items specified in the XML metadata as well as methods to perform appropriate operations on entities. For this example, we use the C# option. • A fragment of the metadata file is as shown following: 11
  • 12. Selenium 12 This XML metadata file, is used to generate page-specific code to perform, among other things, the following: • Validate all the specified page elements in an entity-specific way (“form”) given a specified locator style, e.g. “XPath” • Perform actions such as Click, SelectByText etc. • Perform a group of actions on a page defined by name, e.g. “EnterLoginCredentials” • Allow the test code to address data shown in Tables in a natural object-oriented way D . H a r r i s o n M a y , 2 0 1 9 D . H a r r i s o n M a y , 2 0 1 9
  • 13. Selenium 13 As part of the generation process (optionally) property files are generated that contain the text to be validated, for each page and each spoken language variant. D . H a r r i s o n M a y , 2 0 1 9
  • 14. Selenium 14 Above is a fragment of a unit test in Visual Studio/C# which performs some scrolling and basic validations. You can see that Selenium data is absent as well as the actual text data being validated -> clean tests D . H a r r i s o n M a y , 2 0 1 9
  • 15. Selenium 15 Separation of Concerns D . H a r r i s o n M a y , 2 0 1 9 UnitTestFrmwk SeleniumFrmwk Page Objects Just code - no data, no tests Validation Data Just data - no code, no tests Unit Tests Only PO objects, no validation data App
  • 16. Selenium Selenium Testing P a g e O b j e c t G e n e r a t i o n • Clean architectural solution • Tests can be structured to facilitate walk-throughs with business actors • Expanding the set of tests can be estimated with confidence • Tests can be designed within the context of agile sprints (stories, story points) – maximise velocity • Changes in Pages can be readily accommodated – update metadata, generate (approach embraces early days testing on a project) • General technology lends itself to running the tests is a cloud DevOps pipeline, e.g. Azure 16
  • 17. Selenium Selenium Testing P a g e O b j e c t G e n e r a t i o n • Scalability – straightforward process to develop new tests. Easy to generate new Page Objects to expand coverage or “maintain” existing ones • Maintainability – Unit tests easy to maintain. Page metadata easy to maintain. All code and generation metadata file can be persisted in Git • Accessibility – unit tests are “standard” so a developer with “general” skill level can maintain. Page object generation can be done by a general project person • Assertiveness – the Page metadata allows for a range of comparisons to be made- starts with, ends with, regex, full etc. 17
  • 18. Selenium THANK YOU h t t p s : / / w w w . d h a r r i s o n c h . c o m / D av i d H a r r i s o n + 4 1 ( 7 9 ) 1 7 6 ‐ 8 9 8 0 d h a r r i s o n _ c h @ y a h o o . c o . u k