玩转Google开源C++单元测试框架Google Test系列(gtest)之六 - 运行参数 [转载]

匿名 (未验证) 提交于 2019-12-03 00:39:02
int _tmain(int argc, _TCHAR* argv[])
{
    testing::InitGoogleTest(
&argc, argv);
    
return RUN_ALL_TESTS();
}

 

int _tmain(int argc, _TCHAR* argv[])
{
    testing::GTEST_FLAG(output) 
= "xml:";
    testing::InitGoogleTest(
&argc, argv);
    
return RUN_ALL_TESTS();
}

 

 

 


<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="3" failures="1" errors="0" time="35" name="AllTests">
  
<testsuite name="MathTest" tests="2" failures="1"* errors="0" time="15">
    
<testcase name="Addition" status="run" time="7" classname="">
      
<failure message="Value of: add(1, 1)  Actual: 3 Expected: 2" type=""/>
      
<failure message="Value of: add(1, -1)  Actual: 1 Expected: 0" type=""/>
    
</testcase>
    
<testcase name="Subtraction" status="run" time="5" classname="">
    
</testcase>
  
</testsuite>
  
<testsuite name="LogicTest" tests="1" failures="0" errors="0" time="5">
    
<testcase name="NonContradiction" status="run" time="5" classname="">
    
</testcase>
  
</testsuite>
</testsuites>

1. --gtest_filter

2. --gtest_output=xml[:DIRECTORY_PATH\|:FILE_PATH]

3. --gtest_catch_exceptions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!