Thursday, July 15, 2010

Selenium is usable and I'm very happy

I always thought Selenium is hard to use and doesn't worth my time. So in the past, I used twill to create a script (python) that would go the site, filling in any forms and did all tests that I would normally do by hand. It's a life saver. You don't want to fill in the large HTML form by hand every time you need to test your app. Using twill, I can just press the Enter key and it will run all tests I want. I can even go take some drink and snacks while the tests is running and get back to see whether it success or not.

But there's one downside with twill, you need to crafts all the test script by hand, looking at each form field you need to fill in. So this time I think it's time to start looking back at Selenium. All cool guys out there are using it to test their applications, it shouldn't be that hard. There's 2 parts of Selenium (actually it's more than that but for now I'd only interested in that 2 parts):-
  • Selenium IDE - Firefox addons that allow you to record your interaction with the browser.
  • Selenium RC - Consists of a server (java application) running on (by default) port 4444 and a client that would connect to the server, open up your browser and running up the test case specified. The client available in few languages - Python, Ruby, PHP, .Net etc.
The cool part is the IDE allow you to export the test case into client language so in the end I can still have something like twill. This is the coolest part. The other cool part is the python client is just a single module that I can copied to my PYTHONPATH and it just work. Now I feel like hugging all my kids and wife telling them, see ... now Selenium is working for me ! Too bad they are all sleeping now ;)

The 'not-so-cool' part, it doesn't work with Javascript popup calendar so you have to enter the date by hand.

No comments: