UI AUTOMATION
        Magus Chen
http://magustest.com/blog/
 maguschen@gmail.com
Agenda

● What is UI Automation
● Common tools and framework
● Selenium2/WebDriver
● Continuous Integration
● Data Driven
● Keyword Driven
● Page Object Pattern
● The Future
What is UI Automation

● End to End functional test
● Executed by program
● Verify result by program
● Report defect by program
● Logging for debug
Common tools and framework

●   Commercial
    ○ HP QuickTest Pro
    ○ IBM Rational Functional Tester
●   Open Source
    ○ Selenium/WebDriver
    ○ Watir
    ○ FitNesse
    ○ Sikuli
Selenium2/WebDriver

● Two sophisticated browser automation frameworks are
   merged
   ○ http://seleniumhq.org/
   ○ http://code.google.com/p/selenium/
● Pros
   ○ APIs in popular languages
   ○ Multi-Browser and Multi-OS
   ○ Support many test frameworks
   ○ Support AJAX
Continuous Integration

● What is CI
● Glue in UI Automation
● Parallel test execution
Data Driven

● Test data + re-usable test logic

   Test data:
  Fields                     Data set 1       Data set 2

  Title                      test title one   long title

  Description                simple desc      unicode desc


   Test logic:
     ○     Navigate to target page
     ○     Fetch test data
     ○     Enter title and description
     ○     Submit form
     ○     Verify result
Keyword Driven

● Based on data driven
● Separate the test script developer and test case designer

  Object            Action      Data                 Comment

  signin_username   input       magus@email.com      username

  signin_password   input       password

  signin_btn        click                            page refresh

  page_title        check       Login successfully
Page Object Pattern

● Reuse test code and reduce duplication
● Readable test code
● Focus on "What to do" instead of "How to do"
● Expose method that represent an element that can be seen and
   can be operated on the page
  driver.findElement(By.id("user")).sendKeys("magus");
  driver.findElement(By.id("pwd")).sendKeys("password");
  driver.findElement(By.id("submit")).click()
                              VS
  login_page.login("magus", "password")
The Future

● Parallel
● Run in the cloud
● Example: http://saucelabs.com

Ui automation

  • 1.
    UI AUTOMATION Magus Chen http://magustest.com/blog/ maguschen@gmail.com
  • 2.
    Agenda ● What isUI Automation ● Common tools and framework ● Selenium2/WebDriver ● Continuous Integration ● Data Driven ● Keyword Driven ● Page Object Pattern ● The Future
  • 3.
    What is UIAutomation ● End to End functional test ● Executed by program ● Verify result by program ● Report defect by program ● Logging for debug
  • 4.
    Common tools andframework ● Commercial ○ HP QuickTest Pro ○ IBM Rational Functional Tester ● Open Source ○ Selenium/WebDriver ○ Watir ○ FitNesse ○ Sikuli
  • 5.
    Selenium2/WebDriver ● Two sophisticatedbrowser automation frameworks are merged ○ http://seleniumhq.org/ ○ http://code.google.com/p/selenium/ ● Pros ○ APIs in popular languages ○ Multi-Browser and Multi-OS ○ Support many test frameworks ○ Support AJAX
  • 6.
    Continuous Integration ● Whatis CI ● Glue in UI Automation ● Parallel test execution
  • 7.
    Data Driven ● Testdata + re-usable test logic Test data: Fields Data set 1 Data set 2 Title test title one long title Description simple desc unicode desc Test logic: ○ Navigate to target page ○ Fetch test data ○ Enter title and description ○ Submit form ○ Verify result
  • 8.
    Keyword Driven ● Basedon data driven ● Separate the test script developer and test case designer Object Action Data Comment signin_username input magus@email.com username signin_password input password signin_btn click page refresh page_title check Login successfully
  • 9.
    Page Object Pattern ●Reuse test code and reduce duplication ● Readable test code ● Focus on "What to do" instead of "How to do" ● Expose method that represent an element that can be seen and can be operated on the page driver.findElement(By.id("user")).sendKeys("magus"); driver.findElement(By.id("pwd")).sendKeys("password"); driver.findElement(By.id("submit")).click() VS login_page.login("magus", "password")
  • 10.
    The Future ● Parallel ●Run in the cloud ● Example: http://saucelabs.com