Discussion
· Sep 21, 2020

Unit Testing Naming Convention

Hi Developers!

Recently we discussed the naming convention on packages we deploy and even made some choices.

Here I want to have a conversation on the naming convention for unit tests.

Of course, we wish every good library has unit tests. Here is the documentation and some good articles(one, two, three) regarding it on the Developer Community.

Let's decide on the naming of UnitTests packages?

The suggestion is that unit test classes will all start with the UnitTest package name.

E.g. if your library's class name is:

johndoe.lib.class

The related unit test class will be:

UnitTest.johndoe.lib.class

What about folders?

The suggestion is that unit test classes will live separately from source classes, e.g. in /tests directory.

Here is the example of a repository with unit tests that are named and placed according to the proposal.

What do you think?

Adopt UnitTest as a prefix for unit test classes
Discussion (6)4
Log in or sign up to continue

I agree with both Tim and Evgeny.  In addition, I will add that we also store our unit tests in a different location, which has a top level of /internal for all of our in-house applications.  We store unit tests and test data in /internal so our integration scripts can explicitly ignore changes in those branches when we're porting things to our LIVE branch.  This ensures that no testing code or testing data ever make it into production.