What techniques can be used to make writing tests more interesting?
tdd, unit-testing
Solution
If you write the tests first, they are your specifications for coding.
All the thinking has to be done when writing tests. "What should it do?" "How will I know it's done it?" "What interfaces does it have that will need to be mocked?"
Further, if you structure your tests using a simple naming convention (using "shoulds") you can more easily determine what's supposed to be happening.
See http://weblogs.asp.net/rosherove/archive/2005/04/03/TestNamingStandards.aspx for some thoughts on this.
If you write the tests last, they are boring, since you know the code works.
Problem
I must admit that I often struggle with practising Test-Driven Development. In spite of using Ruby on Rails which makes TDD super easy because it's baked-in, I find writing tests to be so boring! It's like dental flossing; I know that I should do it but struggle to muster much enthusiasm. - What techniques do you use to make writing tests interesting? For example, one tip I saw was to invent a little story around the test fixture data rather than just using meaningless, unrelated data.