Selenium Workshop Corey McGarrahan QA Lead rSmart
Questions, Slides and Links Please feel free to ask questions at any time Slides will be available at: http://www.slideshare.net http://confluence.sakaiproject.org/display/QA/Selenium http://confluence.sakaiproject.org/display/QA/Selenium+Remote+Control+and+TestNG 11th Sakai Conference - June 15-17, 2010
Tools needed Add-ons Using Seleium IDE Recording  Playback Test Suites Selenium/TestNG Project Setup Use What We’ll Cover 11th Sakai Conference - June 15-17, 2010
A cautionary tail… 11th Sakai Conference - June 15-17, 2010
Selenium IDE
Additional Add-ons…
Open up the IDE
IDE Controls
Record a Test
Steps... Navigate to webpage Start Recording Execute Test Procedure Stop Recording Edit (if needed)
XPath Selenium IDE will give you options for the 'target' value.
XPath Using the Firebug Inspect function will give you additional options for the 'target' value.
Manual XPath Any element that has an attribute (The first matching element will be selected): // input [@ value =' submit '] <input type= &quot;image&quot;  src= &quot;/library/skin/rsmart/images/loginButton.gif&quot;  value= &quot;submit&quot; /> An  input  with a value of  submit . Any element that 'contains' an attribute with specific text: // a [ contains (@ href ,' resources.doc& ')] <a title= &quot;Attach a copy&quot;  href= &quot;localhost:8080/resources.doc&sakai_action=doAttachitem&quot; >Attach a copy</a> An  a  element that contains an href attribute with the text  resources.doc&  anywhere in it. In this case the  title  attribute could not be used because there was more than one element on the page with the title value of  Attach a copy .
Test Suite
Test Suite Selenium IDE allows for creation of Test Suites right in the IDE.
Test Suite Example
Selenium RC and TestNG
Sakai Test Suite Selenium Remote Control Selenium Remote Control (RC) is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser. Selenium RC comes in two parts. A server which automatically launches and kills browsers, and acts as a HTTP proxy for web requests from them. Client libraries for your favorite computer language.   TestNG TestNG is a testing framework inspired from JUnit and NUnit but introducing some new functionality that make it more powerful and easier to use, such as: JDK 5 Annotations (JDK 1.4 is also supported with JavaDoc annotations). Flexible test configuration. Support for data-driven testing (with @DataProvider). Support for parameters. Allows distribution of tests on slave machines. Powerful execution model (no more TestSuite). Supported by a variety of tools and plug-ins (Eclipse, IDEA, Maven, etc...). Embeds BeanShell for further flexibility. Default JDK functions for runtime and logging (no dependencies). Dependent methods for application server testing. TestNG is designed to cover all categories of tests: unit, functional, end-to-end, integration, etc..
Sakai Test Suite Kick off test_suite from the command line with two commands: ant launch-remote-control ant -Dsuite=sakai-suite-setup-27.xml
Links Selenium and Xpath http://confluence.sakaiproject.org/display/QA/Selenium Selenium and TestNG http://confluence.sakaiproject.org/display/QA/Selenium+Remote+Control+and+TestNG Sakai Test Suite https://source.sakaiproject.org/contrib/qa/trunk/functional

Sakai10 Selenium Workshop

  • 1.
    Selenium Workshop CoreyMcGarrahan QA Lead rSmart
  • 2.
    Questions, Slides andLinks Please feel free to ask questions at any time Slides will be available at: http://www.slideshare.net http://confluence.sakaiproject.org/display/QA/Selenium http://confluence.sakaiproject.org/display/QA/Selenium+Remote+Control+and+TestNG 11th Sakai Conference - June 15-17, 2010
  • 3.
    Tools needed Add-onsUsing Seleium IDE Recording Playback Test Suites Selenium/TestNG Project Setup Use What We’ll Cover 11th Sakai Conference - June 15-17, 2010
  • 4.
    A cautionary tail…11th Sakai Conference - June 15-17, 2010
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
    Steps... Navigate towebpage Start Recording Execute Test Procedure Stop Recording Edit (if needed)
  • 11.
    XPath Selenium IDEwill give you options for the 'target' value.
  • 12.
    XPath Using theFirebug Inspect function will give you additional options for the 'target' value.
  • 13.
    Manual XPath Anyelement that has an attribute (The first matching element will be selected): // input [@ value =' submit '] <input type= &quot;image&quot; src= &quot;/library/skin/rsmart/images/loginButton.gif&quot; value= &quot;submit&quot; /> An  input  with a value of  submit . Any element that 'contains' an attribute with specific text: // a [ contains (@ href ,' resources.doc& ')] <a title= &quot;Attach a copy&quot; href= &quot;localhost:8080/resources.doc&sakai_action=doAttachitem&quot; >Attach a copy</a> An  a  element that contains an href attribute with the text  resources.doc&  anywhere in it. In this case the  title  attribute could not be used because there was more than one element on the page with the title value of  Attach a copy .
  • 14.
  • 15.
    Test Suite SeleniumIDE allows for creation of Test Suites right in the IDE.
  • 16.
  • 17.
  • 18.
    Sakai Test SuiteSelenium Remote Control Selenium Remote Control (RC) is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser. Selenium RC comes in two parts. A server which automatically launches and kills browsers, and acts as a HTTP proxy for web requests from them. Client libraries for your favorite computer language.   TestNG TestNG is a testing framework inspired from JUnit and NUnit but introducing some new functionality that make it more powerful and easier to use, such as: JDK 5 Annotations (JDK 1.4 is also supported with JavaDoc annotations). Flexible test configuration. Support for data-driven testing (with @DataProvider). Support for parameters. Allows distribution of tests on slave machines. Powerful execution model (no more TestSuite). Supported by a variety of tools and plug-ins (Eclipse, IDEA, Maven, etc...). Embeds BeanShell for further flexibility. Default JDK functions for runtime and logging (no dependencies). Dependent methods for application server testing. TestNG is designed to cover all categories of tests: unit, functional, end-to-end, integration, etc..
  • 19.
    Sakai Test SuiteKick off test_suite from the command line with two commands: ant launch-remote-control ant -Dsuite=sakai-suite-setup-27.xml
  • 20.
    Links Selenium andXpath http://confluence.sakaiproject.org/display/QA/Selenium Selenium and TestNG http://confluence.sakaiproject.org/display/QA/Selenium+Remote+Control+and+TestNG Sakai Test Suite https://source.sakaiproject.org/contrib/qa/trunk/functional