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!):
or
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.
Test class naming convention usually follows the naming convention of the class being tested, e.g., the class under test is “Order” the corresponding test class will be “OrderTests“. When in doubt, it is a good practice to model the test class name after the production class it is testing.
The name of your test should consist of three parts: The name of the method being tested. The scenario under which it's being tested. The expected behavior when the scenario is invoked.
The main difference is the ability of MsTest to execute in parallel at the method level. Also, the tight integration of MsTest with Visual Studio provides advantages in both speed and robustness when compared to NUnit. As a result, I recommend MsTest.
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
-Tests Folder
I personally would go with
Company.Tests.Website
That way you have a common tests namespace and projects inside it, following the same structure as the actual project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With