tags:

views:

46

answers:

2

Hello Everyone,

Long time viewer, first time questioner here. Using Unit Tests in a separate project, I can't figure out how to separate them at the release build?

Surely when I remove the reference to the Unit Test project, all the references to the Unit Test interfaces, won't be able to find the interfaces and will cause compiler errors?

Thanks for any help.

Edit: By separating I mean removing them on the release build.

+2  A: 

Assuming .NET, your unit test project should have a reference to the production project - but not the other way round. Your production code shouldn't depend on your unit tests at all.

Jon Skeet
Thank you for your answer as well.
JohnGlave
+1  A: 

You should have built your two projects, so that the base code (That in which you are testing) has no dependencies on the unit test. It is the Unit Test that has the dependencies on your code.

From what you wrote, I gather you wrote your code in .NET? (i.e. Assemblies?). Your project dependencies should look like this.

// Business code

My_Project.dll

-> References

---> System.dll etc..


// Test code

My_Project_Test.dll

-> References

---> My_Project.dll

If you make your projects that way, than I think you won't have to do anything special in your release build configuration.

C Johnson
Thanks for the demonstration! I thought it was the other way around, thanks again.
JohnGlave