unit testing - keep tests in current project or separate?
-
Hello, when you write unit tests, do you make special project for them, or do you keep that with your code? I cannot decide, because: - tests nicely document code, I want them in my project - test code have no place in release that goes live, I want them in separate project. Where do you keep your unit tests, and why?
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
-
Hello, when you write unit tests, do you make special project for them, or do you keep that with your code? I cannot decide, because: - tests nicely document code, I want them in my project - test code have no place in release that goes live, I want them in separate project. Where do you keep your unit tests, and why?
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
dnh wrote:
when you write unit tests, do you make special project for them, or do you keep that with your code?
Separate project.
dnh wrote:
tests nicely document code, I want them in my project
Tests should be isolated from the code they test.
dnh wrote:
test code have no place in release that goes live, I want them in separate project.
Exactly.
Upcoming events: * Glasgow: Geek Dinner (5th March) * Edinburgh: Web Security Conference Day for Windows Developers (12th April) My: Website | Blog | Photos
-
dnh wrote:
when you write unit tests, do you make special project for them, or do you keep that with your code?
Separate project.
dnh wrote:
tests nicely document code, I want them in my project
Tests should be isolated from the code they test.
dnh wrote:
test code have no place in release that goes live, I want them in separate project.
Exactly.
Upcoming events: * Glasgow: Geek Dinner (5th March) * Edinburgh: Web Security Conference Day for Windows Developers (12th April) My: Website | Blog | Photos
Thanks Colin.
Colin Angus Mackay wrote:
dnh wrote: test code have no place in release that goes live, I want them in separate project. Exactly.
I was playing with idea to keep tests in same project but exclude from release build, however separate project seems to be most obvious, straightforward and better solution. :) When I started to write my website and ended up with about 8 projects (3layers+utils+tests) for thing that did literally nothing it seemed too much. Well I guess it's ok ;)
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
-
dnh wrote:
when you write unit tests, do you make special project for them, or do you keep that with your code?
Separate project.
dnh wrote:
tests nicely document code, I want them in my project
Tests should be isolated from the code they test.
dnh wrote:
test code have no place in release that goes live, I want them in separate project.
Exactly.
Upcoming events: * Glasgow: Geek Dinner (5th March) * Edinburgh: Web Security Conference Day for Windows Developers (12th April) My: Website | Blog | Photos
I keep them separate as well. In addition to what Colin says, you don't want any dependencies on your unit testing libraries or utilities, such as NUnit and NMock in your production projects.