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. 5
DISCLAIMER
S E L E N I U M T E S T S A R E N OT A
REPLACEMENT FOR REGULAR UNIT
TESTING. THEY ONLY PROVIDE AN
ADDITIONAL SET OF TESTS FOCUSED
ON USER ACCEPTANCE AND USER
EXPERIENCE TESTING.
For more information about unit testing, please
see my other material on www.slideshare.net and
www.speakerdeck.com. Search for “dragonbe”!
9. 9
Func'onal
tes'ng
• Test
func'onal
requirements
-‐ e.g.
no
access
to
profile
without
authen'ca'on
• Test
UI
elements
on
the
web
interface
-‐ e.g.
buTons,
form
elements,
AJAX
controls,
…
10. A
word
of
cau'on!
10
• UA
tests
only
test
generated
output
-‐ not
a
replacement
for
unit
tes'ng
• UA
tests
are
heavily
depending
on
DOM
-‐ changes
to
the
DOM
might
lead
to
failing
UAT
38. Advantages
38
• 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
plaforms
• Con'nuous
Integra'on
possible
50. The
GRID
50
• Procedure
-‐ centralized
server
(HUB)
-‐ commands
clients
(nodes)
registered
-‐ and
executes
the
tests
• Goal
-‐ allow
for
automa'on
-‐ adding
clients
as
you
go
51. Selenium
Grid
Setup
51
Selenium Testing
CI Server Windows
"HUB"
Linux client
"NODE"
CI executes tests
Windows HUB launches
Selenium node clients
to execute tests
Windows Server collects
feedback from the Citrix
client nodes and reports
back to CI Server
Windows client
"NODE"
Mac OS X client
"NODE"
Continuous User Acceptance Testing
52. Star'ng
the
server
[HUB]
52
"C:Program FilesJavajre7binjava.exe"
-jar "C:Jarselenium-server-standalone-2.28.0.jar"
-role hub
-port 12666