sakai10 selenium workshop

20
Selenium Workshop Corey McGarrahan QA Lead rSmart

Upload: coreyjack

Post on 23-Jun-2015

737 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Sakai10 Selenium Workshop

Selenium Workshop

Corey McGarrahanQA LeadrSmart

Page 2: Sakai10 Selenium Workshop

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

Page 3: Sakai10 Selenium Workshop

• Tools neededo Add-ons

• Using Seleium IDEo Recording o Playbacko Test Suites

• Selenium/TestNG Projecto Setupo Use

11th Sakai Conference - June 15-17, 2010

What We’ll Cover

Page 4: Sakai10 Selenium Workshop

A cautionary tail…

11th Sakai Conference - June 15-17, 2010

Page 5: Sakai10 Selenium Workshop

Selenium IDE

Page 6: Sakai10 Selenium Workshop

Additional Add-ons…

Page 7: Sakai10 Selenium Workshop

Open up the IDE

Page 8: Sakai10 Selenium Workshop

IDE Controls

Page 9: Sakai10 Selenium Workshop

Record a Test

Page 10: Sakai10 Selenium Workshop

Steps...

oNavigate to webpageoStart RecordingoExecute Test ProcedureoStop RecordingoEdit (if needed)

Page 11: Sakai10 Selenium Workshop

XPath

Selenium IDE will give you options for the 'target' value.

Page 12: Sakai10 Selenium Workshop

XPath

Using the Firebug Inspect function will give you additional options for the 'target' value.

Page 13: Sakai10 Selenium Workshop

Manual XPathAny element that has an attribute (The first matching element will be selected)://input[@value='submit']<input type="image" src="/library/skin/rsmart/images/loginButton.gif" value="submit"/>• An input with a value of submit.

Any element that 'contains' an attribute with specific text://a[contains(@href,'resources.doc&')]<a title="Attach a copy" href="localhost:8080/resources.doc&sakai_action=doAttachitem">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.

Page 14: Sakai10 Selenium Workshop

Test Suite

Page 15: Sakai10 Selenium Workshop

Test Suite

Selenium IDE allows for creation of Test Suites right in the IDE.

Page 16: Sakai10 Selenium Workshop

Test Suite Example

Page 17: Sakai10 Selenium Workshop

Selenium RC and TestNG

Page 18: Sakai10 Selenium Workshop

Sakai Test SuiteSelenium Remote ControlSelenium 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.

1. 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.

 

TestNGTestNG 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..

Page 19: Sakai10 Selenium Workshop

Sakai Test SuiteKick off test_suite from the command line with two commands:ant launch-remote-controlant -Dsuite=sakai-suite-setup-27.xml

Page 20: Sakai10 Selenium Workshop

Links• Selenium and Xpath

o http://confluence.sakaiproject.org/display/QA/Selenium• Selenium and TestNG

o http://confluence.sakaiproject.org/display/QA/Selenium+Remote+Control+and+TestNG

• Sakai Test Suiteo https://source.sakaiproject.org/contrib/qa/trunk/functional