运行gtest util会失败

Run gtest util it fails

本文关键字:失败 util gtest 运行      更新时间:2023-10-16

是否有一种方法可以在Visual Studio中运行Google测试,直到它失败?

我的TEST_F(PersistentStorageTestFixture, test_PSF_U13)测试失败了,但间歇性。我需要一次又一次地运行它,直到失败,有什么想法吗?

您可以在Google Test命令之后放置选项。要仅运行一些单元测试,您可以使用-gtest_filter = test_name*命令行选项,具有正则表达式的值。

然后,您可以创建一个脚本以在循环中运行程序,直到它返回与0不同的东西。

// Use this macro in main() to run all tests.  It returns 0 if all
// tests are successful, or 1 otherwise.
//
// RUN_ALL_TESTS() should be invoked after the command line has been
// parsed by InitGoogleTest().
#define RUN_ALL_TESTS()
  (::testing::UnitTest::GetInstance()->Run())