2

I am new to unit testing.

I have introduced source control into my working practices. I am a single developer. I am planning to introduce unit testing. My question is: do developers have one unit test project per source control branch or one project per repository or perhaps one project per system project I.e. one project for business logic layer, one for data logic layer etc.

w0051977
  • 15,099
  • 32
  • 152
  • 329
  • possible duplicate of [Single vs. Multiple Unit Test Projects per Solution?](http://stackoverflow.com/questions/5042892/single-vs-multiple-unit-test-projects-per-solution) – Jim D'Angelo Jul 10 '13 at 18:33

2 Answers2

1

I tend to follow one-for-one projects. This allows my test projects to mimic the structure of the project and keep in scope exactly what the tested project "sees." (This is further supported by making the default namespace of the test project match the tested project.)

Of course, this is usually for larger or more complicated projects. If you have a few projects that are pretty light, there is no reason you couldn't reasonably put all your tests into one project.

Jim D'Angelo
  • 3,952
  • 3
  • 25
  • 39
0

Definition of Unit Testing, quoted from here:

Test Driven Design is a robust way of designing software components (“units”) interactively so that their behaviour is specified through unit tests. That’s all!

Given your small program you could also prefer Smart UI rather than creating a neat Domain Driven Solution, because it's more efficient.

It's up to you how to design your structure. If it's really small I would put all together in one project, if you think it could grow, I would choose a more atomary structure, so you can only run tests based on your changes.

You should put more effort in figuring out what you want to test rather than where to put it.

There is also a more complete answer here.

Community
  • 1
  • 1
Fabian Bigler
  • 10,403
  • 6
  • 47
  • 70