Nothing is as frustrated as deploying a new release of your web application to find out functionality you had doesn't work anymore. Of course you have all your unit tests in place and you run them through your CI environment, but nothing prepared you to a failing javascript error or a link that doesn't work anymore. Welcome to User Acceptance testing or UAT. Before you start putting real people in front of your application, create macros and export them as PHPUnit test classes. Then run them in an automated way just like your unit tests and hook them into your CI. In this talk I will show you how easy it is to create Selenium macros that can be converted into PHPUnit scripts and run automatically on different virtual machines (VM's) so you can test all different browsers on a diversity of operating systems.
4. Today’s
goal
• Set
up
and
use
Selenium
IDE
• Record
UA
tests
• Convert
to
PHPUnit
• Run
con'nuously
• Mul'
browser
support
4
5. DISCLAIMER
SELENIUM TESTS ARE NOT A
REPLACEMENT FOR REGULAR UNIT
TESTING. THEY ONLY PROVIDE AN
ADDITIONAL SET OF TESTS FOCUSED ON
U S E R A C C E P TA N C E A N D U S E R
EXPERIENCE TESTING.
For more information about unit testing, please
see my other material on www.slideshare.net and
www.speakerdeck.com. Search for “dragonbe”!
5
9. Func'onal
tes'ng
• Test
func'onal
requirements
-‐
e.g.
no
access
to
profile
without
authen'ca'on
-‐
e.g.
buTons,
form
elements,
AJAX
controls,
…
• Test
UI
elements
on
the
web
interface
9
10. A
word
of
cau'on!
• UA
tests
only
test
generated
output
-‐
not
a
replacement
for
unit
tes'ng
-‐
changes
to
the
DOM
might
lead
to
failing
UAT
• UA
tests
are
heavily
depending
on
DOM
10
38. Advantages
• You
can
start
tes'ng
immediately
• Even
test
“hard
to
test”
kind
of
situa'ons
• More
nodes
for
parallel
tes'ng
• Tes'ng
different
browsers
and
plaeorms
• Con'nuous
Integra'on
possible
38
50. The
GRID
• Procedure
-‐
-‐
-‐
centralized
server
(HUB)
commands
clients
(nodes)
registered
and
executes
the
tests
-‐
-‐
allow
for
automa'on
adding
clients
as
you
go
• Goal
50
51. Selenium
Grid
Setup
Selenium Testing
Windows HUB launches
Selenium node clients
to execute tests
CI executes tests
Windows client
NODE
Linux client
NODE
CI Server
Windows
HUB
Windows Server collects
feedback from the Citrix
client nodes and reports
back to CI Server
Mac OS X client
NODE
Continuous User Acceptance Testing
51
52. Star'ng
the
server
[HUB]
C:Program FilesJavajre7binjava.exe
-jar C:Jarselenium-server-standalone-2.28.0.jar
-role hub
-port 12666
52