views:

37

answers:

1

So far I've always stored my unit test on my HDD, as I'm the only one in the company to actually care about them, but I'm thinking of cheking them in the repository in order to use them in my CI server, and look into code coverage, so I'm wondering... where do you find the corresponding projects to be better stored in a SVN repository? along with the projects they "cover", or in their own project structure?

Idea 1:

Project A\trunk\Project A
Project A\trunk\Project A.Tests

Idea 2:

Project A\trunk\Project A
Unit Tests\trunk\Project A.Tests

I see their own pros and cons to both possibilities, so I just want to get a small push :P.

+3  A: 

Tests are part of the product but only used by your company. You should check them in and version control them.

I suggest the first option as then the tests as seen as part of project A and not as something separate.

Also by checking them in, if other access this code, then they get to see it and thus you get them looking at tests, even if they never write any, they can use them to verify that the stuff they've done hasn't broken anything. If anything this is the most important reason for having the tests.

Preet Sangha
Indeed, when you're not sure about wether you should use A or B, consider what you want to branch/tag atomically. You need to be able to branch your unit tests together with your actual code, so the first option is the only right one.
Sander Rijken
Well, I get the points, and already thought of most of them before writing, but being in an environment where most people ignore unit tests, or don't even know what they are, and in a project where backwards compatibility is always present, and branches are rarely made, I find some arguments against them, ie: unit tests are surely just ran by me (or the CI server), and added by me, new tests are rarely added, and therefore, there will be less needs of making tests tags than main project ones. But I guess you are right and A is the way to go.
Neverbirth