有没有办法在Visual Studio中运行google测试,直到它失败?
我有TEST_F(PersistentStorageTestFixture, test_PSF_U13)
测试失败,但它是间歇性的。我需要一次又一次地运行它,直到它失败,任何想法?
答案 0 :(得分:0)
您可以在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())