Last week I spoke at
php[tek] 2013 where I explained to people how to get started with
Selenium IDE to record user interaction with the web interface, convert them to PHPUnit testcases and
automatically execute them on multiple browsers on multiple platforms.
The
feedback I got was awesome, you're all a great crowd! But on
twitter I also received a bunch of questions regarding how to set up multiple platforms and why I used Windows in my presentation
to deploy to.
So today I deceided it was time to write a full article on this subject.
What is Selenium?
Selenium is a tool that allows you to continuously test user interfaces of web applications. The most common usages for Selenium testing are the following:
- testing elements are (not) on the web interface
- users can't break out a certain flow on the web interface
- calculated values are correct after modification
- errors appear on screen when mistakes are made by users
- reported issues are valid
In general we call these type of tests User Acceptance Tests or UAT and are all focused from the point of the end-user, the person using the web interface to accomplish a certain goal.
Why are they important?
UAT have their own right to exist. Just like regular unit, performance and stress tests they have their own agenda and are adressing a particular part of your application that needs testing. All to prevent your customers/visitors from finding issues, bugs or just unfunctional pieces on your web application and loose their trust in your
products or services.
Therefor it's always good to invest in the "visibile" part of your web application. Especially when using javascript, you want to ensure it always works as intended.
Disclaimer
Selenium tests are in no way a replacement for regular unit tests. Their focus is on generated output of your web application within a browser. Unit tests are still necessary to ensure the logic of your application is not broken when making modifications or adding new functionality!
Setting things up
You can write your own Selenium tests by hand, but the easiest way is to use the
Truncated by Planet PHP, read more at the original (another 36325 bytes)