Is your test suite valuable?
Posted by Jeremy Voorhis Mon, 21 Aug 2006 21:39:00 GMT
Is your test suite valuable? I mean, is it actually making your code better? Answer the following questions to find out.
- Are your tests inexpensive to run?
- Are there any inhibitions to running your full suite of unit tests before every check-in?
- Is the process of running tests uncomplicated?
- Do all of your tests pass?
- In practice, are your tests your first line of defense against new bugs? Ideally, you can know if you have introduced a bug within minutes.
- Is test-first development actually preferred by your team? Writing tests should be rewarding.

7. Are your tests good documentation? That is, do they express intent?
8. Are your tests short?
9. Are your tests maintained with the same love that the rest of your production code is (aka do you recognise your tests as production code as much as the rest of it).
10. Do you start to get a funny twitch when something gets checked in that stops the tests from running.
Checking in code that breaks the tests can easily be prevented with setting up hooks in you SCM that runs the tests and only accepts the commit/patch if the tests are successful.
I recently did this with Darcs, my SCM of choice easily:
changepref test "rake migrate && rake"This will check out all patches, inlcuding the pending one to a temp dir, and run the tests from there. If they pass, the pach gets recorded.
Luke’s 9 is a good one :)
11. Do your programmers have a panic attack 5 minutes into a refactoring?
I really need to start testing more. Im naughty. Ok ‘more’ is being nice to myself.