0
Automated UI testing.     Selenium
Gold Sponsor ofDrupalCamp Kyiv 2011
Silver Sponsors ofDrupalCamp Kyiv 2011
Plan    What is Selenium?    Selenium IDE, RC, Webdriver    Integration to Drupal    Tests API, locators, examples   ...
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 t...
Selenium 2 Webdriver    Communicate with browsers in native way via    drivers     Not limited to javascripts. For examp...
Selenium2 Webdriver and Drupal    How to integrate to simpletest              In order to get into sandbox we need to se...
Drupal tests API    Main class DrupalSeleniumWebTestCase    Init driver as connection to Selenium server    Already imp...
Selenium 2 locatorscss, id, name, class, link, xpath
XPath vs CSS locatorsSelenium RC has sizzleWebdriver uses native browsers CSS selectors.CSS selectors are fasterXPath can ...
Drag and drop example
Run tests on headless server     Key tool: Xvfb – X11 server that performs all graphical    operations in memory, not sho...
Future    Implement methods from DrupalWebTestCase    Start using Selenium in testing contrib modules    and core (modul...
References     Selenium RC supported browsers http://www.seleniumwiki.com/software-    testing/selenium-supported-browser...
QuestionsВаша фотка   email: yuri.gerasimov@gmail.com             twitter: ygerasimov             skype: yuriy_gerasimov  ...
Upcoming SlideShare
Loading in...5
×

Automated UI testing.Selenium.DrupalCamp Kyiv 2011

4,089

Published on

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,089
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
96
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Transcript of "Automated UI testing.Selenium.DrupalCamp Kyiv 2011"

  1. 1. Automated UI testing. Selenium
  2. 2. Gold Sponsor ofDrupalCamp Kyiv 2011
  3. 3. Silver Sponsors ofDrupalCamp Kyiv 2011
  4. 4. Plan What is Selenium? Selenium IDE, RC, Webdriver Integration to Drupal Tests API, locators, examples Future
  5. 5. What is Selenium? Selenium IDE Selenium RC Selenium Grid Selenium 2 (Webdriver)
  6. 6. Selenium IDE Addon to Firefox Easy to start using Can record tests in PHP Demo
  7. 7. Selenium RC Run in multiple browsers in Virtual Boxes Runs tests via Javascript
  8. 8. 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
  9. 9. 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
  10. 10. 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
  11. 11. 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...)
  12. 12. Selenium 2 locatorscss, id, name, class, link, xpath
  13. 13. XPath vs CSS locatorsSelenium RC has sizzleWebdriver uses native browsers CSS selectors.CSS selectors are fasterXPath can go upExample:id(user1)/../../td[@class="actions"]/a[@class="delete-user"]
  14. 14. Drag and drop example
  15. 15. Run tests on headless server Key tool: Xvfb – X11 server that performs all graphical operations in memory, not showing any screen output (http://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
  16. 16. Future Implement methods from DrupalWebTestCase Start using Selenium in testing contrib modules and core (module draggableviews already have one selenium test)
  17. 17. References Selenium RC supported browsers http://www.seleniumwiki.com/software- testing/selenium-supported-browsers PHPUnit documentation about Selenium http://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
  18. 18. QuestionsВаша фотка email: yuri.gerasimov@gmail.com twitter: ygerasimov skype: yuriy_gerasimov d.o.: http://drupal.org/user/257311
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×