A method of naming UnitTests that allows the test class to be read as descriptive documentation of the class under test. Invented by ChrisStevenson.
A unit test class is named after the class under test. E.g. a test for the Sheep class would be called SheepTest or SheepTests.
The methods of the test class are named to complete a sentence that begins with "A class-under-test...". E.g. the methods of SheepTest would be named to continue the sentence "A Sheep...".
For example, in Java:
public class SheepTest { @Test public void eatsGrass() { ... } @Test public void bleatsWhenFrightened() { ... } @Test public void producesDeliciousMilk() { ... } @Test public void movesAwayFromSheepdogs() { ... } }This can be read as:
More expressive languages do not need this convention, because tests can be implemented as blocks associated with string descriptions of what is being tested.