Evgeny Shvarov · 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:


The related unit test class will be:


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

Register or login to poll

Yes, UnitTest works for me
No, we need something else, I'll add in a comment
Not sure what you are talking about
0 6 100 4


I already use this approach as much as possible, both for the applications I develop and my Open Exchange projects. It makes it easy to trace from test to tested unit, and (in the community package manager world) it avoids collisions between different packages all trying to use the same unit test package. I strongly agree with Evgeny's recommendation.

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.  

Thanks, Ben!

This is another good topic for discussion on should the test code be included in the production

Hi Evgeny,

I agree. We use a UnitTest package for everything UnitTesty. We keep all of the UnitTest classes in a UnitTest namespace/database and map them to our live namespaces.


I prefer