Automated UI testing with Selenium

  • 10,146 views
Uploaded on

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.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
10,146
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
127
Comments
0
Likes
5

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Automated UI testing. Selenium Yuriy Gerasimov [email_address] Skype yuriy_gerasimov Twitter ygerasimov
  • 2. What is Selenium?
    • Selenium IDE
    • 3. Selenium RC
    • 4. Selenium Grid
    • 5. Selenium 2 (Webdriver)
  • 6. Selenium IDE
    • Addon to Firefox
    • 7. Easy to start using
    • 8. Can record tests in PHP
    • 9. Demo
  • 10. Selenium RC
    • Run in multiple browsers in Virtual Boxes
    • 11. Runs tests via Javascript
  • 12. Selenium RC
    • To install Selenium RC download java server from http://seleniumhq.org/download
    • 13. Run Selenium IDE tests via PHPUnit
      • Ubuntu: apt-get install phpunit
      • 14. If php 5.2 make a preference for karmic like for php
    • Demo
  • 15. Selenium 2 Webdriver
    • Communicate with browsers in 'native' way via drivers
    • 16. Not limited to javascripts. For example: upload files, work with popups, iframes etc.
    • 17. Support for a lot of browsers including mobile phone browsers
    • 18. PHPUnit libraries: https://github.com/chibimagic/WebDriver-PHP
  • 19. Selenium2 Webdriver and Drupal
    • How to integrate to simpletest
      • In order to get into sandbox we need to set headers
      • 20. This is possible with Firefox only (send custom profile to Selenium)
    • http://drupal.org/project/selenium
    • 21. Demo
  • 22. Drupal tests API
    • Main class DrupalSeleniumWebTestCase
    • 23. Init driver as connection to Selenium server
    • 24. Already implemented methods:
      • drupalOpenUrl, drupalLogin, drupalLogout, verboseScreenshot ...
    • class SeleniumWebElement (sendKeys, click, submit, getText...)
  • 25. Selenium 2 locators
    • css, id, name, class, link, xpath
  • 26. Drag and drop example
  • 27. 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).
    • 28. Before we start Selenium server we need to start Xvfb.
    • 29. Run tests from shell:
    • 30. sudo -u www-data php ./scripts/run-tests.sh --url http://URL --class SeleniumTestExample
  • 31. Future
    • Implement methods from DrupalWebTestCase
    • 32. Start using Selenium in testing contrib modules and core (module draggableviews already have selenium test)
  • 33. References
    • Selenium RC supported browsers h ttp://www.seleniumwiki.com/software-testing/selenium-supported-browsers
    • 34. PHPUnit documentation about Selenium h ttp://www.phpunit.de/manual/3.5/en/selenium.html#selenium.selenium-rc
    • 35. http://ygerasimov.com/integrating-selenium-to-drupal-simpletest-framework
    • 36. http://ygerasimov.com/run-selenium-tests-drupal-on-debian-headless
    • 37. http://ygerasimov.com/drupal-selenium-tests-api
  • 38. Automated UI testing. Selenium Yuriy Gerasimov [email_address] Skype yuriy_gerasimov Twitter ygerasimov