Skip to content

Old Tests: A project smell

March 24, 2011

There are lots of books and posts about code smells and how to detect them. There are even automatic code-smell-detectors like Reek and Rails Best Practices.

I propose yet another metric to add, this time at the project level: old tests. When we are practising proper BDD or TDD, we write failing tests first and code to follow. Unfortunately, we do not always live up to these principles, and neither do our colleagues who are working on our programs. When someone else edits the program you are working on, it would be good to know if they also updated the tests (not necessarily in the same commit, but recently).

So I think what we need is a metric that looks at models and their tests and makes sure that the editing is consistent. As a heuristic, if the test for a model has not been updated since, say, a day before the code was edited, chances are the tests need to be updated.

It seems like that should be very easy to detect, so I am going to try to write a gem to do just that.

From → Uncategorized

Leave a Comment

Leave a comment