Tuesday, August 28, 2007

The Best Practice of JUnit

JUnit Recipes > 1.3 A few good practices > 1.3.1 Naming conventions for tests and test classes

1.3.1 Naming conventions for tests and test classes

1.3.2 Test behavior, not methods

This brings us to another recommendation when writing tests: your tests should
focus on the behavior they are testing without worrying about which class is under
test. This is why our test names tend to be verbs rather than nouns: we test behavior
(verbs) and not classes (nouns).

... so we recommend focusing your test effort on
the object as a whole, rather than its parts.

No comments: