UI Automation Testing
Best practices and Patterns
Overview
BDD is a process designed to aid the management and the delivery of software
development projects by improving communication between engineers and business
professionals. By aiding communication between these two teams, BDD ensures all
development projects remain focused on delivering what the business actually needs
while meeting all requirements of the user.
Why do we need BDD?
Regression testing vs New features
What to cover
Item 3
● End to End tests / E2E
● User interactions and business logic
● Self-contained modules
● User stories
Best practices
● PageObjects pattern
● User stories / Cucumber scenarios
● Selector order: data > id > css > xpath
● Relative URLs
● Creta datasets
● Make Screenshots on failures
Page Objects
Item 3
AbstractPage
- getUrl()
- validatePage()
- clearCookies()
- navigate()
HomePage
- getTopSearchBox()
- getLoginForm()
- getRegistrationForm()
- validate()
OrdersPage
- getOrdersList()
- getPendingOrdersTable()
- validate()
User Stories
Item 3
Element selectors
Item 3
div#main div.full-height-page div#plans-compare div.container section.plans-section.plans-section--
api div.col-l-3.col-ie-3 a.button
CSS
Element selectors
Ex 1: /html/body/div[1]/div[2]/div/div/div/div/section[3]/div[2]/a
XPath
Ex 2: //div[@id="myid"]//div[@class="myclass"]//p[text()="found my text"]
Element selectors
Item 3
[data-qaid=video-box]
Data attribute
ID attribute
#video-box
Problems to overcome
Item 3● Prepare testing DB with preset datasets
● Access external APIs
● Run tests under different browsers (IE, FF, Chrome,
Safari)
● Run tests for different screen dimensions
Question?

Ui automation testing

  • 1.
    UI Automation Testing Bestpractices and Patterns
  • 2.
    Overview BDD is aprocess designed to aid the management and the delivery of software development projects by improving communication between engineers and business professionals. By aiding communication between these two teams, BDD ensures all development projects remain focused on delivering what the business actually needs while meeting all requirements of the user.
  • 3.
    Why do weneed BDD?
  • 4.
  • 5.
    What to cover Item3 ● End to End tests / E2E ● User interactions and business logic ● Self-contained modules ● User stories
  • 6.
    Best practices ● PageObjectspattern ● User stories / Cucumber scenarios ● Selector order: data > id > css > xpath ● Relative URLs ● Creta datasets ● Make Screenshots on failures
  • 7.
    Page Objects Item 3 AbstractPage -getUrl() - validatePage() - clearCookies() - navigate() HomePage - getTopSearchBox() - getLoginForm() - getRegistrationForm() - validate() OrdersPage - getOrdersList() - getPendingOrdersTable() - validate()
  • 8.
  • 9.
    Element selectors Item 3 div#maindiv.full-height-page div#plans-compare div.container section.plans-section.plans-section-- api div.col-l-3.col-ie-3 a.button CSS
  • 10.
    Element selectors Ex 1:/html/body/div[1]/div[2]/div/div/div/div/section[3]/div[2]/a XPath Ex 2: //div[@id="myid"]//div[@class="myclass"]//p[text()="found my text"]
  • 11.
    Element selectors Item 3 [data-qaid=video-box] Dataattribute ID attribute #video-box
  • 12.
    Problems to overcome Item3● Prepare testing DB with preset datasets ● Access external APIs ● Run tests under different browsers (IE, FF, Chrome, Safari) ● Run tests for different screen dimensions
  • 13.