创建 Google 测试
创建 Google 测试:
- 访问File >New Project >Test Project 。
- 选择Google Test Project >Choose ,为 Google 测试创建一个带有模板代码的项目。
- 在Project and Test Information 对话框中,指定项目和测试的设置:
- 在Test framework 中,选择Google Test (shared libraries) 链接 Google 测试,或选择Google Test (headers only) 在项目中包含必要的 Google 测试源。
- 在Test suite name 中,输入测试套件的名称。
- 在Test case name 中,输入测试用例的名称。
- 对于共享库测试,可在Googletest install directory (optional) 中设置 Google C++ 测试框架的安装路径。
- 对于纯头文件测试,可在Googletest source directory (optional) 中设置 googletest 资源库克隆的路径。
- 在Build system 中,选择用于构建项目的构建系统:CMake、qmake 或 Qbs。
Qt Creator 在指定的项目目录中创建测试。
有关创建 Google 测试的更多信息,请参阅《Google 测试入门》。
注意: 在扫描测试时,解析器只考虑直接或间接包含gtest/gtest.h
的文件。目前不会构建的文件将被忽略。
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.