如何让谷歌测试在QtCreator中执行多个测试文件
How to get Google Test to execute multiple test files in QtCreator?
我在Qt Creator中使用了Google Test,并编写了两个测试文件,一个是tst_a.h(默认生成)。
另一个文件是我自动创建的 tst_b.h,但在单元测试期间只执行 tst_a.h。
如何让谷歌测试执行tst_b.h?
请查找上述文件的内容。
这是tst_a.h
#include <gtest/gtest.h>
#include <gmock/gmock-matchers.h>
#include "Decimal.hpp"
using namespace testing;
TEST(contractTestCase, contractTestSet)
{
EXPECT_EQ(1, 1);
ASSERT_THAT(0, Eq(0));
}
这是tst_b.H
#include <gtest/gtest.h>
#include <gmock/gmock-matchers.h>
using namespace testing;
TEST(testNormal, contractNormalTestSet)
{
EXPECT_EQ(1, 1);
}
在头文件中编写测试时,这些头文件需要包含在 cpp 中,以便编译器可以看到它们。默认测试设置以 main 开头.cpp您可以在其中为新的 .h 文件添加包含。
相关文章:
- 测试操作系统时执行程序集"sti"时虚拟框崩溃
- CMake:防止在子目录库项目中生成测试可执行目标
- 谷歌测试可执行文件中的单元测试未被vstest选中
- 为多个测试文件构建可执行文件
- cppUnit:针对多个测试方法执行一次的设置函数
- 在我的测试程序中,为什么 cv::resize 不能执行,而 cvtColor 可以?
- 将我的主输出库与测试可执行文件链接时出现问题
- 如何测试基类中的方法是否已使用谷歌模拟调用和执行?
- 测试执行后缺少某些GCDA文件
- QTest在方法而不是主中执行测试
- 在单独的可执行文件中调用INSTANTIATE_TEST_CASE_P时,库中的TEST_P测试不会运行
- 使用 ASSERT_DEATH 时,有没有办法在应用程序终止后自动继续执行所有测试
- CMake添加(测试)可执行文件
- 如何让谷歌测试在QtCreator中执行多个测试文件
- GTEST测试项目链接链接到其他可执行文件
- 谷歌测试:如果测试失败,则执行其他操作
- 提升单元测试似乎跳过了应执行的代码
- 自动执行 MFC 类的测试
- 从谷歌测试框架中的另一个测试执行测试
- 如何处理构建谷歌测试执行文件的自动工具