zr.*_*zr. 9 c++ unit-testing googletest
我想为尚未实现的功能添加一个测试用例,并将此测试用例标记为" 我可以失败 ".
有没有办法做到这一点?
编辑:我希望测试执行,只要测试用例处于"预期的失败"状态,框架就应该验证它是否失败.
编辑2:似乎我感兴趣的功能在google-test中不存在,但它确实存在于Boost单元测试框架和LIT中.
EXPECT_NONFATAL_FAILURE 是您想要包装预期失败的代码的内容。请注意,您必须包含 gtest-spi.h 头文件:
#include "gtest-spi.h"
// ...
TEST_F( testclass, testname )
{
EXPECT_NONFATAL_FAILURE(
// your code here, or just call:
FAIL()
,"Some optional text that would be associated with"
" the particular failure you were expecting, if you"
" wanted to be sure to catch the correct failure mode" );
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4114 次 |
| 最近记录: |