Naming Conventions for JUnit

Finding common naming conventions for software development items (variables, classes, etc.) is a major factor to help people collaborate in software development projects. Finding good names is also good if you work on your own and have to revisit your code some months after you wrote it. In this blog post Frank Appel discusses his experience with naming JUnit tests.

It is important to find a meaningful test name because this information displayed at the top of the reports. The post discusses the two alternatives that are possible when you name your JUnit tests: naming unit tests by methods or trying to include the behavior in the name. Frank Appel also presents the BUILD-OPERATE-CHECK5 pattern that allows splitting up the the phases into separate sub method names placed within single tests. The article contains also some interesting pointers to other resources focused on Java unit tests naming conventions.

Read the complete blog post on