Search code examples
unit-testingtdd

Should I document my unit test methods?


As it happens with private methods, unit test methods documentation can only be seen by who has access to the source code. Is it worth the effort spent on it?

By documentation I mean something like (but more descriptive):

/// <summary>
///A test for SomeClass.SomeMethod
///</summary>
[TestMethod()]
public void SomeMethodTest()
{
}

Solution

  • Unit tests should aim to be self descriptive, but there will always be cases where this goal cannot be achieved and thus description of what has been written is due.

    In other words, try to make your unit tests so they don't need documentation, but if they need it, write it!