Criteria to assess the usefulness of a unit test

I deleted all my photos


From the keynote at XpDay London: Mark Striebeck, engineering manager at Google where he is responsible for developer testing infrastructure, tools and adoption.

Here are some criteria to assess the usefulness of a unit test
  • How often the test fails? When the test never fails there are chances that it is not testing anything that need tests.

  • Has the test been marked as "ignore" to release the system? So it's failure is not a real bug.

  • When the test is red, what changes are needed usually to fix it?
    • add or change a feature => ok
    • change the test code => ko, a false alarm
    • other changes => ko, a false alarm
It never fails or it is often ignored or it raises false alarms most of the times? This means that it is not giving back very much value. My advice: come on, just delete it !!!

And I add this advice, don't forget that the primary benefit of unit test and TDD is to make emerge a good design. Update: I learned that is perfectly acceptable TDD can be used to focus also on specifications and verifications, looks TDD Continuum.


Update: more notes on this keynote here: Improving testing practices at Google
Update: the blog of Google about Testing: http://googletesting.blogspot.com/

Print | posted @ Saturday, December 12, 2009 2:25 PM

Comments on this entry:

Gravatar # re: Criteria to assess the usefulness of a unit test
by Gil Zilberfeld at 12/16/2009 2:24 PM

Hi Luca,

In our latest installment of our webcast This week in testing, we talked about your post (actually on your description of Mark’s presentation). I invite you to check it out, comment and if you really like what you see, and want to see more, spread the word.

Gil Zilberfeld, Typemock
Comments have been closed on this topic.