Visual Studio and Boost::Test

三世轮回 提交于 2019-12-03 06:01:59

They way I've added Boost unit tests to existing solutions was to create new projects and put the test code in those projects. You don't need to worry about creating a main() function or setting up the tests. Boost takes care of all that for you.

Here is a project I put on Google Code that uses Boost for its unit tests.

You can put your tests to the same project, but mark files with tests as Excluded from Build for Release and Debug configuration and create new project configuration for unit tests. Here is an article about using Boost Test in Visual Studio.

We don't have boost test but use cppunit but this should be pretty general. We have very thin main project (basically only consisting of main.cpp) all the other files are in libraries (mostly static for us). The test code links against these libraries and includes what ever it needs per test. This also keeps you from having to have all the applications code included in the test project.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!