0% found this document useful (0 votes)
209 views12 pages

Selenium: Remote Control

This document discusses Selenium and its uses for automated testing. It introduces the different Selenium versions: IDE, Core, and RC. Selenium RC allows controlling browsers from Java and works well with the SimpleTest framework for assertions. Setting up Selenium RC requires a Java server and properly installed Firefox. Writing tests with the Selenium and SimpleTest combination provides reports and ensures code stays functional after refactoring. The document also covers common Selenium commands, locators, and links to additional resources.

Uploaded by

Rama Krishnan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
209 views12 pages

Selenium: Remote Control

This document discusses Selenium and its uses for automated testing. It introduces the different Selenium versions: IDE, Core, and RC. Selenium RC allows controlling browsers from Java and works well with the SimpleTest framework for assertions. Setting up Selenium RC requires a Java server and properly installed Firefox. Writing tests with the Selenium and SimpleTest combination provides reports and ensures code stays functional after refactoring. The document also covers common Selenium commands, locators, and links to additional resources.

Uploaded by

Rama Krishnan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Selenium

Remote Control

Tobias Ebnöther for


Unit Testing
• Tests modules (usually classes)
• Verifies the public interface (API)
• A test should test just one module
• Great for re-factoring - you are reassured that your code still
works

y
eor
Th
sic
Ba
Selenium Versions
• Three different versions (that matter)
• IDE: Firefox extension
• Core: JavaScript library
• RC: Java Proxy (can run in chrome://)

Core IDE RC
Browsers All Firefox Many

! e
Requires server access Yes No No

on
ht
rig
Multi-domain No Yes Yes

e
th
se
HTTPS Yes Yes No

U
Test-Driven Development
• Dogmatic:
• Tests are written before the code
• Only code is written for which tests already exist

• Pragmatic:
• Test are written before or with the code
• Only most frequent cases being tested
• All bug-fixes are being tested

it!
o
D
it!
o
D
Selenium Remote Control
• Requirements:
• Java Server
• Properly installed Firefox
• Selenium Protocol handling (e.g. pear Testing_Selenium)

• Looks easy:
$selenium = new Testing_Selenium("*chrome", "http://liip.ch");
$selenium->start();
$selenium->open("/");

rs
ne
rt
$page_title = $selenium->getTitle();

pa
r
if ($page_title == ‘Liip AG’) { echo “YALLAH!\n”; }

fo
ok
Lo
SimpleTest
• “Classic” Unit testing
• HTTP Requests

• It’s easy:
class TestValidations extends UnitTestCase {
function testValidate() {
$this->assertIdentical(true, hlprs_validation::validate(‘email’, ‘[email protected]’);
}
}

e!
pl
sim
a,
,y
hm
U
Selenium RC & SimpleTest
• Nice duo:
• Control the browser, while simpletest is doing the assert
work
• Get nice reports

• Not much left to do:


function testLiipTitle() {
$this->selenium->open("/");
$this->assertEqual('Liip AG', $this->selenium->getTitle());
}

E!
IC
N
Common Stuff
Commands:
• getTitle • getText • isVisible

• getPath • isTextPresent • click

Locators:
• identifier • name • xpath • css

• id • dom • link

Suffixes:

RC
• •

in
AndWait WaitFor

ns
tio

nc
Not (deprecated with simpletest)

fu
e
or
C
all
ot
N
Bamboo
• Blame the build breaker
• Get nice statistics
• Locate errors, when needed (e.g. backend) components fail

!
ne
hi
ac
m
y
m
n
so
ild
Bu
Social
• It's NOT a waste of time
• It's not much extra work when you do it right away
• Manual testing is reduced to a minimum
• You know a bug really is fixed (and will remain fixed)
• But: requires some initial effort
• Get the team on board
• For the local.ch frontend a bug is only fixed when a test exists
• Show the value (“I found this bug because of Selenium”)

?t
ar
st
u
yo
ill
w
n
he
W
Links
• http://openqa.org
• http://simpletest.org
• http://release.openqa.org/selenium-core/0.8.0/reference.html
• http://developer.local.ch/php/selenium_class

f
uf
st
ol
co
e
m
nd
Se
Thanks to Patrice Neff
He made me believe in Unit Testing and lend me some slides :)
Visit http://blog.patrice.ch

Time for questions

You might also like