selenium

35
SELENIUM

Upload: g2ix

Post on 31-Oct-2014

9 views

Category:

Education


1 download

DESCRIPTION

Automated testing using Selenium

TRANSCRIPT

Page 1: Selenium

SELENIUM

Page 2: Selenium

Speakers Aaron Tinio• [email protected]

Bernard Lago• [email protected]

Page 3: Selenium

Goals

• To be able to consider implementation of automated testing• To jumpstart Selenium usage

Page 4: Selenium

Pre-requisites

• HTML• Javascript• Ruby or other scripting/programming language

Page 5: Selenium

Selenium 101 Selenium Introduction Selenium IDE Basics Selenium RC Basics Selenium GRID Demo

Page 6: Selenium

SELENIUM INTRODUCTION

Page 7: Selenium

Selenium Introduction Why choose Selenium? Types of Functional Test Tools for Web Apps “Flavors” of Selenium Selenium IDE Basics

Page 8: Selenium

Why choose Selenium? Open source Backed by Industry Players Stable and Well Tested Platform-independent Uses a real browser Allows you to use your favorite programming language

Page 9: Selenium

Types of Functional Test Tools Use of a simulated browser: HttpUnit, HtmlUnit & WebTest Use of a real browser: Selenium, Watir (and FireWatir and

SafariWatir)

Page 10: Selenium

Flavors of Selenium Selenium Core Selenium IDE Selenium RC (and Selenium Grid)

Page 11: Selenium

SELENIUM IDE

Page 12: Selenium

Selenium IDE Installation, overview and usage Locators Actions, Accessors, Assertions Patterns

Page 13: Selenium

Locators id• id=gbar

name• name=q

dom• dom=document.links[0]

xpath• xpath=//html/body/center/form/table/tbody/tr/td[2]/input[2]

link• link=English

Page 14: Selenium

Actions open(url) click(locator) type(locator, value) select(locator, optionLocator)

Page 15: Selenium

Accessors

• storeText(locator, variableName)• from getText(locator) command

• storeLocation(variableName)• from getLocation() command

Page 16: Selenium

Assertions

• assertText(locator, pattern)• from getText(locator) command

• assertLocation(pattern)• from getLocation() command

OTHER ASSERTIONS:

• verifyText• waitForText• verifyLocation• waitForLocation

Page 17: Selenium

Patterns exact• exact:Google.com in English

glob• glob:*in English

regexp• regexp:Go+gle\.com in English

regexpi• regexpi:go+gle\.com in english

Page 18: Selenium

SELENIUM REMOTE CONTROL

Page 19: Selenium

Selenium Remote Control Selenium RC Architecture Selenium RC Server Selenium RC Ruby Client Driver Testing Frameworks for Ruby Prototyping tests in IRB Writing tests (Ruby / Test::Unit)

Page 20: Selenium

Selenium RC Architecture

Page 21: Selenium

Selenium Server: Interactive Mode is a way of rapidly prototyping tests. requires no coding whatsoever. allows you to immediately see the results.

Starting the server in interactive mode:java -jar selenium-server.jar -interactive [otherOptions]

Page 22: Selenium

Selenium RC (Ruby Client Driver)

• requires ruby

• requires rubygems

• requires selenium-client gem• gem install selenium-client

Page 23: Selenium

Testing Frameworks (Ruby)

• Test-Driven Development (TDD)• Test::Unit

• Behaviour-Driven Development (BDD)• Rspec

• TDD + BDD• Shoulda• test/spec

Page 24: Selenium

Interactive Ruby Shell

• is a shell for programming in the Ruby language

• allows the programmer to experiment with codes

Page 25: Selenium

Writing tests (Ruby / Test::Unit) Require the following in the test script• 'rubygems'• 'selenium/client'• 'test/unit'

Create a class that subclasses Test::Unit::TestCase.

Define “setup” method to set up the common test fixture.• create a new Selenium::Client::Driver object• run the “start” method on the selenium driver object

Add a method that begins with "test" to the class. • make assertions in the test method.

Define “teardown” method to tear down the test fixture.• run to “stop” method on the selenium driver object

Page 26: Selenium

Writing tests (Example)

Page 27: Selenium

SELENIUM GRID

Page 28: Selenium

Selenium Grid

• Selenium Grid Architecture

• Selenium Grid Demo

Page 29: Selenium

Selenium Grid Architecture

Page 30: Selenium

Selenium Grid Demo

• Running scripts on multiple machines using different browsers

• Sample Environment Configurations• Firefox on Linux• Internet Explorer on Windows• Firefox on Windows

Page 31: Selenium

QUESTIONS ???

Page 32: Selenium

REFERENCES

Page 33: Selenium

References

• http://seleniumhq.org/projects/ide/

• http://seleniumhq.org/projects/core/

• http://seleniumhq.org/projects/remote-control/

• http://selenium-client.rubyforge.org/

• http://selenium-grid.seleniumhq.org/

Page 34: Selenium

Maestrodev

• www.maestrodev.com• Forums• Downloads• Announcements

Page 35: Selenium

Thank you!!!