如何使用gtest运行部分测试用例

时间:2014-04-26 03:03:06

标签: c++ unit-testing googletest

在gtest main中,使用时

int main(int argc, char **argv)
{
    printf("Running tests\n");
    testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();

}

它总是运行所有测试。

有没有办法运行一些特定的测试?

1 个答案:

答案 0 :(得分:1)

首先,您不需要为gtest编写main()。您只需链接到gtest_main库以及gtest库。这与你的相似。

其次,要运行特定测试,请参阅advanced options