Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to place unit test project

I'm thinking about where to put the unit/integration test project. I follow the 1 test project pr. project convention

I can think of 3 ways, that all seems good to me, which make it kind of hard to choose :-)

  1. Test project is put under a Tests sub folder to the project it tests.
  2. Test project is put next to the project it tests, in a "project".Tests folder. I believe this is what Roy Osherove recommends.
  3. Put all test projects in a sub folder in the root. e.g. \Tests\"project".Tests
  4. Something else?

What you choose and why?

like image 964
Karsten Avatar asked Mar 30 '10 12:03

Karsten


2 Answers

Option 2 is my preferred one. Aside from anything else, it's just the default when you create a new class library project - it's under the same solution directory as the production project(s).

To counter the argument about checking out a project without its tests, I find it relatively rare to check out just a project rather than a whole solution. If you're a more "project-based" than "solution-based" shop, that could change things.

like image 161
Jon Skeet Avatar answered Nov 01 '22 19:11

Jon Skeet


I like to have all projects in the same level physically. I have no big argument, just for simplicity. After all visual studio shows all projects in the same level.

.../Project/Project.Web/
.../Project/Project.Model/
.../Project/Project.DataAccess/
.../Project/Project.UnitTest/
etc
like image 34
Claudio Redi Avatar answered Nov 01 '22 21:11

Claudio Redi