2013-04-27

Structuring Unit Tests

A very fine idea for naming and nesting unit tests:

To have a nested class for each method being tested.

Sources:

This little trick, this one simple sentence, is like a missing piece in the jigsaw. I liked it from the very start. It fits very well alongside guides for naming of testing methods, like expressed in this article:

http://blog.stevensanderson.com/2009/08/24/writing-great-unit-tests-best-and-worst-practises/

I just wonder how this practice could fit into JUnit. Will have to try.

Also on the same page:

No comments: