47
Selenium and Sauce Labs Jason Huggins twitter: @hugs email: [email protected]

Selenium and Sauce Labs

  • Upload
    hugs

  • View
    120

  • Download
    0

Embed Size (px)

DESCRIPTION

An overview of Selenium, including Selenium IDE, Selenium RC, Selenium Grid, and Sauce OnDemand (A cloud-hosted Selenium test infrastructure service). Also covers an overview of upcoming features in Selenium 2, and how to best use Selenium: use of the Page Object patter, and how to use with continuous integration.

Citation preview

Page 1: Selenium and Sauce Labs

Selenium and Sauce Labs

Jason Hugginstwitter: @hugs

email: [email protected]

Page 2: Selenium and Sauce Labs

Agenda• Overview of Selenium

• Selenium IDE, RC, Grid

• Sauce Labs and Sauce OnDemand

• Demo

• Selenium IDE, Sauce OnDemand

• Tips and Tricks

• Selenium 2

• Q&A

Page 3: Selenium and Sauce Labs

The Problem

Page 4: Selenium and Sauce Labs

Automated

Source: - F.O.X.: http://www.flickr.com/photos/kv/499219/

Page 5: Selenium and Sauce Labs

Ajax

Page 6: Selenium and Sauce Labs

Workflows

Page 7: Selenium and Sauce Labs

What is Selenium?

Page 8: Selenium and Sauce Labs

Selenium IDE for Firefox

Page 9: Selenium and Sauce Labs

“Selenese”

Page 10: Selenium and Sauce Labs

10

!"#$%"&'$(%)$*

+%%,-..///01*234)03$#.,+$%$5.23"6$(".789:;8<=:

Page 11: Selenium and Sauce Labs

Example Selenium RC Test - Java

Page 12: Selenium and Sauce Labs

Example Selenium RC Test - C#

Page 13: Selenium and Sauce Labs

Python, Ruby, Java, C#, or Perl

Test ScriptHTTP

Your AwesomeWeb App

Selenium RC Server

HTTP HTTP

Selenium Remote Control

Page 14: Selenium and Sauce Labs

Time

Servers

Unit of Work

Page 15: Selenium and Sauce Labs

Time

Servers

Unit of Work

Page 16: Selenium and Sauce Labs

!"#$

%&&'())***+,-#./"+.01)'%0&02)$345)67879:;)

Selenium Grid

Page 17: Selenium and Sauce Labs

http://www.flickr.com/photos/pagedooley/2511369048/sizes/l/

Sauce Labs

Page 18: Selenium and Sauce Labs

What Sauce Labs Does

• Cloud-hosted Selenium for:• Speed—run tests in parallel• Pain-free infrastructure (test infrastructure is notoriously fussy, fiddly

due to accelerating Browser numbers and version pace, security patches etc.)

• Higher availability, repeatability• Value-added (enhanced, certified) distros:

• Sauce RC (Selenium RC (remote control))• Sauce IDE (Selenium IDE)

• Commercial Support for Selenium

Page 19: Selenium and Sauce Labs

!"#$

%&&'())***+,-#./"+.01)'%0&02)$345)67879:;)

Sauce OnDemand (just like Grid)

Page 20: Selenium and Sauce Labs
Page 21: Selenium and Sauce Labs

Demo!

Page 22: Selenium and Sauce Labs

How to Avoid Selenium Poisoning

Page 23: Selenium and Sauce Labs

Intent Action

Page 24: Selenium and Sauce Labs

Action

• open 'www.example.com'

• clickAndWait 'link=Log in'

• type 'User Id', '[email protected]'

• type 'password', '12345678'

• clickAndWait 'Log In'

Page 25: Selenium and Sauce Labs

Intent

• Log in

• Change password

• Modify profile

• Log out

Page 26: Selenium and Sauce Labs

1. Write intent.2. Map to actions.

Page 27: Selenium and Sauce Labs

Seek higher level abstractions

Page 28: Selenium and Sauce Labs

Hudson

Ant/NAnt

xUnit

Selenium

Page 29: Selenium and Sauce Labs

Hudson

Ant/NAnt

xUnit

Business Specific Library

Selenium

Page 30: Selenium and Sauce Labs

Page Object Model

Page 31: Selenium and Sauce Labs

Google: “Selenium Page Objects”

Page 32: Selenium and Sauce Labs
Page 33: Selenium and Sauce Labs

Start small

Page 34: Selenium and Sauce Labs

It’ll get big anyway

Page 35: Selenium and Sauce Labs

What to start with?

• Smoke tests

• “Money path”

• New features

Page 36: Selenium and Sauce Labs

Benefits of Short Tests

• Easier to read

• Easier to write

• Easier to debug/maintain

• Easier to parallelize

Page 37: Selenium and Sauce Labs

Selenium 2?

Page 38: Selenium and Sauce Labs

• Native Keyboard & Mouse Events• Same Origin Policy / XSS / HTTP(S)• Pop-ups, dialogs

– Basic Authentication– Self-signed certificates– File upload/download

Better Control

Page 39: Selenium and Sauce Labs
Page 40: Selenium and Sauce Labs

• WebDriver Object

• WebElement Objects

Cleaner API

Page 41: Selenium and Sauce Labs

Python, Ruby, Java, C#, or Perl

Test ScriptHTTP

Your AwesomeWeb App

Selenium RC Server

HTTP HTTP

Selenium Remote Control

Page 42: Selenium and Sauce Labs

Python, Ruby, Java, C#, or Perl

Test ScriptHTTP

Your AwesomeWeb App

Selenium RC Server

HTTP HTTP

Selenium 2

Page 43: Selenium and Sauce Labs

Python, Ruby, Java, C#, or Perl

Test Script

Your AwesomeWeb App

HTTP HTTP

Page 44: Selenium and Sauce Labs

Python, Ruby, Java, C#, or Perl

Test Script

Your AwesomeWeb App

C/C++ HTTP

Page 45: Selenium and Sauce Labs

But... Java... Is... Still... In... There...

Python, Ruby, Java, C#, or Perl

Test ScriptHTTP

Your AwesomeWeb App

Selenium Grid

HTTP HTTP

Page 46: Selenium and Sauce Labs

But... Java... Is... Still... In... There...

Python, Ruby, Java, C#, or Perl

Test ScriptHTTP

Selenium Remote Server

HTTP HTTPYe Ol' Internet(Sauce Labs)

... but now only when you need it.

Page 47: Selenium and Sauce Labs

Q&A