I’m curious what software test methodologies and tools you use. Are you religious about Test Driven Development (TDD)? Do you use Rails’ Test::Unit, or do you prefer alternate tools such as Behavior Driven Development with rspec? A list of the test-related plugins you use would be interesting to see.
We’re big believers in the benefits of testing, but I wouldn’t call it religious. I personally rarely get into the flow of writing my tests first, except for transformation-style methods that takes known A and turns it into known B. I find that test-first often doesn’t fit my brain all that great for molding beautiful APIs. I know, though, that it works wonders for others and I deeply respect that approach. On our team, it seems to work especially well for Jamis at times.
I’m perhaps also a little on the fringe in regards to how much I test. I don’t believe that getting 100% coverage is worth it in most cases. Especially not when it comes to testing view code. For our applications, it simply changes too often and the criticality of display bugs is low and very rarely realized anyway.
The areas of testing where I personally derive the most benefit is from object-interaction tests. Like testing the signup form that creates a handful of records at once and need to spread error checking across the lot. Or dealing with project limits in Basecamp that’ll interrogate multiple other classes. Or API interactions for the creation of Writeboards.
For people new to testing, though, I would recommend going all-out from the start. The only way to get a good grasp on when you can be more lax in your testing is to have done “too much” for a while and identified areas that could go with less without materially hurting your productivity now and in the future. So in that sense, easing your testing rigor is a late-stage optimization that needs to be done with great care. If you’re ever in doubt whether to spend time testing or not, test.
In terms of tooling, we’re using the vanilla Test::Unit flavor that ships with Rails. I’m personally not convinced that rspec holds much improvement over it and I tend to think the DSL-style has been taken a tad too far. But I do like the BDD-style focus of naming your tests in terms of “should” and I use that in my own style. In the large scheme of things, it really doesn’t matter one way or another. The important thing is that you test and if rspec and BDD makes testing more enjoyable for you, rock on.
Also, while I don’t think striving for 100% test coverage is worth it in most cases, it’s nice to know where you stand none the less. The rcov package provides a great way of seeing how you tests are holding up and where you might be lacking.