有没有办法在 Visual Studio 中运行谷歌测试直到它失败??
我有此 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())
关于c++ - 运行测试直到失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47388888/