.NET Testing Naming Conventions

Seb Nilsson picture Seb Nilsson · Sep 17, 2008 · Viewed 8.8k times · Source

What are the best conventions of naming testing-assemblies in .NET (or any other language or platform)?

What I'm mainly split between are these options (please provide others!):

  • Company.Website - the project
  • Company.Website.Tests

or

  • Company.Website
  • Company.WebsiteTests

The problem with the first solution is that it looks like .Tests are a sub-namespace to the site, while they really are more parallel in my mind. What happens when a new sub-namespace comes into play, like Company.Website.Controls, where should I put the tests for that namespace, for instance?

Maybe it should even be: Tests.Company.Website and Tests.Company.Website.Controls, and so on.

Answer

Claus Thomsen picture Claus Thomsen · Sep 17, 2008

I will go with

* Company.Website - the project
* Company.Website.Tests

The short reason and answer is simple, testing and project are linked in code, therefore it should share namespace.

If you want splitting of code and testing in a solution you have that option anyway. e.g. you can set up a solution with

-Code Folder

  • Company.Website

-Tests Folder

  • Company.Website.Tests