architecting test automation using selenium
TRANSCRIPT
![Page 1: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/1.jpg)
1871 Hackers - March Meetup
Architecting test automation using Selenium
David Adams, QA Manager
Kapow Events
[email protected]/in/dadamschi
![Page 2: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/2.jpg)
about: David Adams
QA Manager @ Kapow Events
Currently architecting Selenium framework in Ruby
Built Selenium framework in Java
Architected automation framework in C#
Taught Selenium/Automation class for ForteKnowledge
Automating since 2009
![Page 3: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/3.jpg)
Soft Elements of a Framework
Vision
Buy-in
People
Code base
![Page 4: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/4.jpg)
Vision
Crucial
Provides a path for buy-in and development
No cocktail napkins
![Page 5: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/5.jpg)
Buy-in
Top-level champion
Software development process
Output is a robust code base
Secure and repeat functional regression
testing; NOT load testing
Goal is NOT to replace people
![Page 6: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/6.jpg)
People
Full-time resources are critical (at least 1)
Software development pipeline
Context switching is deadly
Credibility can get hurt
Automation gets shelved
![Page 7: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/7.jpg)
Code base
Keep language to dev language (if possible)
Configuration management
Use same resources as development (libraries,
et. al.)
![Page 8: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/8.jpg)
Hard Elements of a Framework
Test driver
Browser Driver
PageObjects
SeleniumGrid
Reporting
Parallelism
![Page 9: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/9.jpg)
Test driver
RSpec, TestNG, Cucumber
Creates a structure for running tests
Provides a list or groups of tests
Creates Before*, After* dynamic calls
![Page 10: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/10.jpg)
Browser driver
Selenium, WATIR
Provides browser commands (open, close/quit,
back, go to URL, etc)
Examines viewport for VISIBLE elements
If you can’t see it, you can’t act on it
![Page 11: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/11.jpg)
PageObjects
Automation development concept
Everything is an object
Each screen or component is a PageObject
Instantiated to organize code in OOP model
Allows for discrete elements on pages
Allows for inheritance of
footer/header/elements
![Page 12: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/12.jpg)
![Page 13: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/13.jpg)
Create a BasePage
Provides page-level methods
Creates page segmentation (footer, header,
content)
![Page 14: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/14.jpg)
SeleniumGrid
Hub/node model for execution of same tests
across different browsers and OSs
Need to maintain your own VMs (or
SauceLabs)
Need to maintain batch scripts on VMs
![Page 15: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/15.jpg)
Reporting
Publicly accessible report of each run
Each test is a story, explain what happened
Each step is reported with inputs, click text; not
just pass/fail of the entire test
![Page 16: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/16.jpg)
Parallelism
THIS saves time
Concerns:o data collision
o reporting
o development
![Page 17: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/17.jpg)
Test Cases
Procedural
Every evaluation is a test
Evaluate in test, not in PageObject
Do NOT ask a test to do only one thing
Use PageObjects to make code read-able
![Page 18: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/18.jpg)
Configuration Management
This is code!
Branch features for development
Allows for team scaling
![Page 19: Architecting test automation using selenium](https://reader036.vdocuments.mx/reader036/viewer/2022071705/55a5ab681a28aba5238b4582/html5/thumbnails/19.jpg)
Gotchas
Elements expire
Record/playback doesn’t work
DON’T USE XPATH
Browser updates cause Se to stop working