GoogleTest:如何跳过测试? [英] GoogleTest: How to skip a test?
本文介绍了GoogleTest:如何跳过测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Google Test 1.6(Windows 7,Visual Studio C ++).如何关闭给定的测试? (aka如何阻止测试运行).除了注释整个测试,我还能做些什么吗?
Using Google Test 1.6 (Windows 7, Visual Studio C++). How can I turn off a given test? (aka how can I prevent a test from running). Is there anything I can do besides commenting out the whole test?
推荐答案
The docs for Google Test 1.7 suggest:
如果您有一个无法立即修复的残破测试,则可以在其名称中添加DISABLED_前缀.这会将其从执行中排除."
"If you have a broken test that you cannot fix right away, you can add the DISABLED_ prefix to its name. This will exclude it from execution."
示例:
// Tests that Foo does Abc.
TEST(FooTest, DISABLED_DoesAbc) { ... }
class DISABLED_BarTest : public ::testing::Test { ... };
// Tests that Bar does Xyz.
TEST_F(DISABLED_BarTest, DoesXyz) { ... }
这篇关于GoogleTest:如何跳过测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文