Shifra Pride Raffel's blog



Javascript thoughts of the day

edit Posted by Shifra Pride Raffel on Thursday December 13, 2007 at 08:48AM

Frankly, I used to disdain Javascript. I thought of it as a toy language (even though my friend Jim Davis implemented a huge nasty content management system in it and kept telling me that there was nothing toy about it). Proficiency in Javascript used to be a marker of low status in my eyes (well, except for Jim, who I just thought of as being perverse). Whenever I had to do anything with it, I swore about the constant errors, the lack of tools, and the general infernal twistedness.

Doing some more javascript and JSUnit stuff today, I'm quite impressed. Firebug allows you to console.debug any object and even to expand your command line to be a good usable size. I finally and reluctantly admit that Javascript is really worth knowing, and you can do serious TDD development with it using JSUnit. Sigh. If only I had listened to you, Jim.

Your Object Mama

edit Posted by Shifra Pride Raffel on Tuesday December 11, 2007 at 10:04PM

I'm more and more convinced that Object Mothers are the way to go to manage test data. I owe my introduction to this pattern to David Goudreau.

A few users and items in fixture data so that you can start up your application and test without adding things from the UI... and then let your tests be self-sufficient: make an Object Mother that generates objects for you with sensible defaults. Instead of relying on fixtures, you know you have an object that nobody else will change. Excellent for reducing test fragility.

It can make builds a bit slower, but the test robustness is worth the tradeoff to me.

I'm busy adding it to my Selenium Tests today and basking in test robustness.