ASP.NET Developers, how important is Control testability to you?

A while ago, Avi posted a message to the Test Driven Development Yahoo! groups list entitled “Testing form validation in ASP.NET”.

He was working around the Model/View/Presenter pattern, and was trying to discover a way to test form validation on the client-side. Although one could implement validation within the presenter itself, he was worried validation would be repeated in multiple locations—on the client-side, within the presenter, and finally the ASP.NET validation server controls themselves.

Rightly, he chose to ignore my advice—I tend to have a way of suggesting rather grandiose solutions to problems :), but the thought has stuck with me. ASP.NET doesn’t make testing easy, and validation is (but) one aspect that it would be useful to exercise independently of the GUI.

In my experience, I’ve not found a good way to test ASP.NET controls without needing to run some kind of through-the-GUI test, and by that I mean testing by exercising the web application the controls sit in.

Although this is useful for integration testing, when starting out it’s a little heavy-weight and requires me to move in larger-than-baby-steps, and often with bad consequence.

So I’m wondering how important testability of controls (and validation in particular) is to other ASP.NET developers?

I’ve written a few validators in the past, and I very am interested to improve the quality of the code now that I’m a little older and (hopefully) wiser. Since Avi’s post surfaced (and I thought about what I’d like to do if it were me), I’m considering widening the scope of my current validation control re-writes—to include a more generic validation framework that is simpler to plug into ASP.NET, reduces the coupling, and more importantly, increases testability outside of the GUI.

Anyway, just wondering whether any other ASP.NET developers have had any validation testing nightmares? Is it enough of a headache to move to a different set of validator controls?