Javascript Functional Testing` 1 comment

I have been suffering from an increasingly bad case of test guilt. Ogham is completely test free. Not one test, not a sausage. The main reason for this is that most of the heavy lifting is done in JavaScript and I did not know of any tool that could be used to test it when I started development.

I set out tonight to try and create some functional tests and hush the nagging little voice in my head that keeps whispering 'If you don't start writing tests soon you will regret it, you never should have let it get this far' . Three tests would do me for starters - creating a page, editing a page, deleting a page, all of the basic operations. I turned to Selenium first. The framework is without doubt impressive but I hit two major stumbling blocks quickly. It doesn't support frames or right clicks which makes Ogham an untestable app as far as Selenium is concerned. I cannot think of any reason why Selenium cant support both, It is simply not implemented.

This is a big let down. The annoying little voice has been repeatedly promised that I would get to grips with Selenium and make everything better soon. I could imagine an evil little monster with an unbearably smug look on its face. The words I told you so are unspoken but still hanging in the air.

I turned to Google for salvation. First hit was jsUnit, A nice tool , but intended for unit testing not functional testing. Next up was Ghost Train, a very promising tool but still in its early days , no real documentation and I could not see how I could pick it up and run with it. Ghost Train is also Firefox only at the moment and I really need to ability to test on Internet Explorer.

Watir looks like it could do everything I need, but its windows and IE only, which rules it right out. IEUnit has exactly the same problems. So after hours of Searching it would appear that the only real choice I have is start hacking on Selenium or build my own tool. If anyone has any other suggestions, please , please help me. I have to silence the nagging little voice.

Comments

Hi Jason, I hope i did'nt come accross as overly critical of selenium. Its not that I dont like the tool. Its just that it doesnt cut it for the project in question (but it has come far closer than any other possible option). Please dont feel any need to apologise for Selenium, its a wonderfull gift to the web development community and one I am already planning on using heavily in a different project with a more traditional web ui. On the right click topic, if you visit the ogham demo you will see what I mean. If you right click on any of the files or folders on the right, you will get a javascript generated menu. I suppose what is needed is some way to generate the same event that javascript catches. Im not sure if that is possible or not. I am going to see if I can track down and grab some of those patches tommorrow night. Frames support alone would solve 90% of my problems. In the long run however I am going to be recoding ogham to do without frames. They are a nasty solution at the end of the day. Yet again thank you for Selenium and your kind response. Sean

Sean O'Donnell 17:32 Thursday the 22nd of September 2005 #

New Comment

required

required (not published)

optional