Tag: Selenium
Selenium: A Complete Unit-testing Solution for Web UIs
by Joshua on Dec.17, 2008, under software

If you were to survey developers, asking them what their least favorite part of the development cycle is, I can pretty much guarantee that the predominant response would be “testing”. Testing is stressful, seemingly endless, and not as creatively challenging as building programs. As a result, many developers simply do not test, or do not test properly and more bug ridden code goes from production to live without anyone noticing. Certainly if testing were easier, many more developers would observe good testing practices.
Luckily there are techniques which can minimize the annoyance of testing. For example, writing unit tests for functions can dramatically reduce the amount of time which a developer has to spend testing. Unfortunately writing unit tests is an act of discipline and an elusive art form. Still the benefits of unit testing outweigh the costs and therefore every developer should be writing unit tests for their code.
“But Joshua”, you might ask, “we’re web developers. Sometimes we do things client/UI side which can be difficult to unit test.” I used to feel that client/UI side unit testing was impossible. A great idea, in theory, but I always felt like a practical client/UI side unit testing framework was a pipe dream. My feelings changed significantly when I came across Selenium. Selenium is everything a client/UI side unit testing framework should be. Not only does Selenium have a pretty decent IDE courtesy of a Firefox plugin, but it also provides a server side module for coordinating testing efforts and launching tests.
Through the Selenium IDE creating new unit tests is easy. From the IDE you can create tests directly by recording mouse and keyboard input. If you need a more complex function than can be deciphered from a mouse click, you can manually tweak the test case as desired. You can then throw these tests on your server and run them via the Selenium control panel. For its part the Selenium control panel will simulate a browser, run your test plan, and provide you feedback on the results.
The best part about Selenium is the flexibility Selenium offers developers. You can use Selenium to validate your web application, on a surface level, writing tests which touch the major blocks of your application or you can use Selenium to run complete Javascript validation functions for cross checking the UI exhaustively at every step of user interaction. All of this flexibility does not come at the cost of ease or integration.
Testing can be a serious pain, but the value of tested code cannot be overstated. Unit testing is a phenomenal methodology for making testing painless, but most unit testing frameworks end at the back-end. Where traditional unit-testing frameworks leave off is where Selenium begins. Selenium offers developers the flexibility and power to thoroughly exercise their web application. In addition, working with Selenium is easy and intuitive. If you are a developer struggling to test the front-end of a web application, you should really give Selenium a closer look.
Check out http://seleniumhq.org/ for more information.
Hey there, Welcome to the Xgineer Blog!
We appreciate you coming by. This is a place for us to talk about all things pertaining to Technology, Start ups, and really just life in general. We enjoy passionate dialogue and conversation please feel free comment and discuss at will. Follow our RSS feed.
Recent Posts
- What other jobs can you get your users to do?
- Xgineer On Yelp, Yelp it up
- How to answer a Craigslist Posting
- Reading and Nodding to…Effective Strategy To Estimating (design) Projects
- Symphony 21
- Game Changing Inspiration – Wolfram
- Proposing Website Costs and Timelines with Integrity
- 3 Tips to Approaching a Company to Build your Website
- New Xgineer Solutions Website
- A PHP Web Shell