This post originated from an RSS feed registered with Ruby Buzz
by Michael Granger.
Original Post: Zen and the Art of Pure TDD
Feed Title: devEiate
Feed URL: http://deveiate.org/feed/rss/blog
Feed Description: A blog about Ruby, codecraft, testing, linguistics, and stuff. Mostly stuff.
I got up early this morning to work on BlueCloth a bit. Ryan Davis (aka zenspider) messaged me about a nifty project of his: a “pure TDD webapp”, written in Rails. He has never seen the app running in a browser – he’s developing it entirely from tests. He asked me to whack on it a while, which I did, which uncovered a few gaps in his testing, but it’s already a nifty application. But even more than that, it’s an interesting idea.
I’ve been writing web applications professionally for around 10 years now, and I’ve always used the switch-back-to-the-browser technique for everything past the unit tests. This hunt-and-poke kind of testing is rife with flaws. At my current client, for example, it’s not uncommon for the less-used areas of the application to quietly rot away as the more-trafficked areas are worked on, only to be discovered much later after the root cause is lost in a changelog that’s hundreds of commits long.
Of course, this is why people have written things like Selenium and Watir, but there aren’t nearly enough people using these tools before they get to QA.
And even they don’t cover another important aspect of the app — the visual design. I’ve been learning quite a lot about usability and user-centered design from Jeff Patton, my sponsor/mentor at ThoughtWorks, and one of the things I’ve been mulling over in my head since I got excited about UX is the idea of codifying some of the user-centered design concepts so that you can write tests for them. Something that would let you assert things like the elements of the main content area of the page should have their left edges aligned, all form fields related to personal information should be grouped together and separated from other form fields, and clicking the ‘save’ button before filling out all the mandatory fields should display a visually-distinctive error message. It sounded pretty impossible to me at first, but the more I think about it, the more I think it’s possible, given a sufficiently robust mechanism for inspection of a browser’s rendering of a page and a set of usability heuristics written in terms of that mechanism. Some things are purely subjective, of course, and for those things you’d have to rely on good old eyeballs, but even if you only got 75% of it formalized it’d be damn useful.
Another thing to add to my list of stuff to do in my Copious Free Time™.