Helping getting started using Boost.Test

前端 未结 5 1198
后悔当初
后悔当初 2020-12-30 07:57

I am trying to start unit testing. I am looking at a few C++ frameworks and want to try Boost.Test. The documentation seems very thorough, and it\'s a bit overwhelming, espe

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-30 08:22

    BOOST.Test is very flexible and you can probably do what you want. However since you say you are new to unit testing, you should probably follow the standard unit testing structure.

    This is to have a separate test project for each project you are unit testing. Then include the sources and libraries you need to build the test project.

    This is cleaner as there are no test logic in your main project that might get run accidentally and it is easy to run the tests as they have their own executable. This approach also works for testing libraries. If you follow this structure you will find that most of the BOOST.Test defaults work out of the box and you can just worry about writing you tests and code.

提交回复
热议问题