Automated UI testing with Selenium
Upcoming SlideShare
Loading in...5
×
 

Automated UI testing with Selenium

on

  • 10,608 views

Presentation from DrupalCafe Kyiv 19 May 2011 about introducing Selenium to testing of Drupal.

Presentation from DrupalCafe Kyiv 19 May 2011 about introducing Selenium to testing of Drupal.

Statistics

Views

Total Views
10,608
Views on SlideShare
9,095
Embed Views
1,513

Actions

Likes
5
Downloads
127
Comments
0

1 Embed 1,513

http://localhost 1513

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Automated UI testing with Selenium Automated UI testing with Selenium Presentation Transcript

  • Automated UI testing. Selenium Yuriy Gerasimov [email_address] Skype yuriy_gerasimov Twitter ygerasimov
  • What is Selenium?
    • Selenium IDE
    • Selenium RC
    • Selenium Grid
    • Selenium 2 (Webdriver)
  • Selenium IDE
    • Addon to Firefox
    • Easy to start using
    • Can record tests in PHP
    • Demo
  • Selenium RC
    • Run in multiple browsers in Virtual Boxes
    • Runs tests via Javascript
  • Selenium RC
    • To install Selenium RC download java server from http://seleniumhq.org/download
    • Run Selenium IDE tests via PHPUnit
      • Ubuntu: apt-get install phpunit
      • If php 5.2 make a preference for karmic like for php
    • Demo
  • Selenium 2 Webdriver
    • Communicate with browsers in 'native' way via drivers
    • Not limited to javascripts. For example: upload files, work with popups, iframes etc.
    • Support for a lot of browsers including mobile phone browsers
    • PHPUnit libraries: https://github.com/chibimagic/WebDriver-PHP
  • Selenium2 Webdriver and Drupal
    • How to integrate to simpletest
      • In order to get into sandbox we need to set headers
      • This is possible with Firefox only (send custom profile to Selenium)
    • http://drupal.org/project/selenium
    • Demo
  • Drupal tests API
    • Main class DrupalSeleniumWebTestCase
    • Init driver as connection to Selenium server
    • Already implemented methods:
      • drupalOpenUrl, drupalLogin, drupalLogout, verboseScreenshot ...
    • class SeleniumWebElement (sendKeys, click, submit, getText...)
  • Selenium 2 locators
    • css, id, name, class, link, xpath
  • Drag and drop example
  • Run tests on headless server
    • Key tool: Xvfb – X11 server that performs all graphical operations in memory, not showing any screen output (h ttp://en.wikipedia.org/wiki/Xvfb).
    • Before we start Selenium server we need to start Xvfb.
    • Run tests from shell:
    • sudo -u www-data php ./scripts/run-tests.sh --url http://URL --class SeleniumTestExample
  • Future
    • Implement methods from DrupalWebTestCase
    • Start using Selenium in testing contrib modules and core (module draggableviews already have selenium test)
  • References
    • Selenium RC supported browsers h ttp://www.seleniumwiki.com/software-testing/selenium-supported-browsers
    • PHPUnit documentation about Selenium h ttp://www.phpunit.de/manual/3.5/en/selenium.html#selenium.selenium-rc
    • http://ygerasimov.com/integrating-selenium-to-drupal-simpletest-framework
    • http://ygerasimov.com/run-selenium-tests-drupal-on-debian-headless
    • http://ygerasimov.com/drupal-selenium-tests-api
  • Automated UI testing. Selenium Yuriy Gerasimov [email_address] Skype yuriy_gerasimov Twitter ygerasimov