创建 Boost 测试
要构建和运行 Boost 测试,请在计算机上安装 Boost.Test。通常情况下,Boost 安装程序中会包含它。从Boost.org 下载 Boost。
如果编译器和构建系统能找到 Boost 库,创建测试时就无需指定包含目录。
创建 Boost 测试
- 访问File >New Project >Test Project 。
- 选择Boost Test Project >Choose ,为 Boost 测试创建一个包含模板代码的项目。
- 在Project and Test Information 对话框中,指定项目和测试的设置:
- 在Test framework 中,选择Boost Test (header only) 以包含所需的头文件,或选择Boost Test (shared libraries) 以链接 Boost 测试。
- 在Test suite name 中,输入测试套件的名称。
- 在Test case name 中,输入测试用例的名称。
- 在Boost include directory (optional) 中,输入包含 Boost.Test 所需文件(如version.hpp和包含测试头文件的测试子文件夹)的目录路径。
- 在Build system 中,选择用于构建项目的构建系统:CMake、qmake 或 Qbs。
Qt Creator 在项目目录中创建测试。
有关创建 Boost 测试的更多信息,请参阅Boost.Test。
注意: 在扫描测试时,解析器只考虑直接或间接包含 Boost 测试库头文件的文件(以boost/test/
开头且后缀为.hpp
的任何 include)。目前不会编译的文件将被忽略。
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.