Automated UI testing. Selenium. DrupalCamp Kyiv 2011

  • 3,853 views
Uploaded on

Presentation held on DrupalCamp Kyiv

Presentation held on DrupalCamp Kyiv

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
3,853
On Slideshare
0
From Embeds
0
Number of Embeds
3

Actions

Shares
Downloads
138
Comments
0
Likes
1

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