Your SlideShare is downloading. ×
0
Automated UI testing. Selenium
<ul>Plan </ul><ul><li>What is Selenium?
Selenium IDE, RC, Webdriver
Integration to Drupal
Tests API, locators, examples
Future </li></ul>
<ul>What is Selenium? </ul><ul><li>Selenium IDE
Selenium RC
Selenium Grid
Selenium 2 (Webdriver) </li></ul>
Selenium IDE <ul><li>Addon to Firefox
Easy to start using
Can record tests in PHP
Demo </li></ul>
Selenium RC <ul><li>Run in multiple browsers in Virtual Boxes
Runs tests via Javascript </li></ul>
Upcoming SlideShare
Loading in...5
×

Automated UI testing. Selenium. DrupalCamp Kyiv 2011

4,115

Published on

Presentation held on DrupalCamp Kyiv

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,115
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
139
Comments
0
Likes
1
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. <ul>Plan </ul><ul><li>What is Selenium?
  3. 3. Selenium IDE, RC, Webdriver
  4. 4. Integration to Drupal
  5. 5. Tests API, locators, examples
  6. 6. Future </li></ul>
  7. 7. <ul>What is Selenium? </ul><ul><li>Selenium IDE
  8. 8. Selenium RC
  9. 9. Selenium Grid
  10. 10. Selenium 2 (Webdriver) </li></ul>
  11. 11. Selenium IDE <ul><li>Addon to Firefox
  12. 12. Easy to start using
  13. 13. Can record tests in PHP
  14. 14. Demo </li></ul>
  15. 15. Selenium RC <ul><li>Run in multiple browsers in Virtual Boxes
  16. 16. Runs tests via Javascript </li></ul>
  17. 17. Selenium RC <ul><li>To install Selenium RC download java server from http://seleniumhq.org/download
  18. 18. Run Selenium IDE tests via PHPUnit </li><ul><li>Ubuntu: apt-get install phpunit
  19. 19. If php 5.2 make a preference for karmic like for php </li></ul><li>Demo </li></ul>
  20. 20. Selenium 2 Webdriver <ul><li>Communicate with browsers in 'native' way via drivers
  21. 21. Not limited to javascripts. For example: upload files, work with popups, iframes etc.
  22. 22. Support for a lot of browsers including mobile phone browsers
  23. 23. PHPUnit libraries: https://github.com/chibimagic/WebDriver-PHP </li></ul>
  24. 24. Selenium2 Webdriver and Drupal <ul><li>How to integrate to simpletest </li><ul><li>In order to get into sandbox we need to set headers
  25. 25. This is possible with Firefox only (send custom profile to Selenium) </li></ul><li>http://drupal.org/project/selenium
  26. 26. Demo </li></ul>
  27. 27. Drupal tests API <ul><li>Main class DrupalSeleniumWebTestCase
  28. 28. Init driver as connection to Selenium server
  29. 29. Already implemented methods: </li><ul><li>drupalOpenUrl, drupalLogin, drupalLogout, verboseScreenshot ... </li></ul><li>class SeleniumWebElement (sendKeys, click, submit, getText...) </li></ul>
  30. 30. Selenium 2 locators <ul><li>css, id, name, class, link, xpath </li></ul>
  31. 31. XPath vs CSS locators <ul><li>Selenium RC has sizzle
  32. 32. Webdriver uses native browsers CSS selectors.
  33. 33. CSS selectors are faster
  34. 34. XPath can go up
  35. 35. Example:
  36. 36. id('user1')/../../td[@class=&quot;actions&quot;]/a[@class=&quot;delete-user&quot;] </li></ul>
  37. 37. Drag and drop example
  38. 38. Run tests on headless server <ul><li>Key tool: Xvfb – X11 server that performs all graphical operations in memory, not showing any screen output (http://en.wikipedia.org/wiki/Xvfb).
  39. 39. Before we start Selenium server we need to start Xvfb.
  40. 40. Run tests from shell: </li></ul><ul>sudo -u www-data php ./scripts/run-tests.sh --url http://URL --class SeleniumTestExample </ul>
  41. 41. Future <ul><li>Implement methods from DrupalWebTestCase
  42. 42. Start using Selenium in testing contrib modules and core (module draggableviews already have one selenium test) </li></ul>
  43. 43. References <ul><li>Selenium RC supported browsers http://www.seleniumwiki.com/software-testing/selenium-supported-browsers
  44. 44. PHPUnit documentation about Selenium http://www.phpunit.de/manual/3.5/en/selenium.html#selenium.selenium-rc
  45. 45. http://ygerasimov.com/integrating-selenium-to-drupal-simpletest-framework
  46. 46. http://ygerasimov.com/run-selenium-tests-drupal-on-debian-headless
  47. 47. http://ygerasimov.com/drupal-selenium-tests-api </li></ul>
  48. 48. <ul>Questions </ul><ul>Ваша фотка </ul><ul>email: [email_address] twitter: ygerasimov skype: yuriy_gerasimov </ul>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.

×