开发者

Unit tests in a separate project

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 开发者_StackOverflowbuild.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜