生成Google C ++单元测试XML报告 [英] Generate Google C++ Unit Test XML Report

查看:137
本文介绍了生成Google C ++单元测试XML报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不熟悉使用Google测试框架进行单元测试,并且打算生成测试的XML报告或命令输出作为报告(我可以很明显地将其打印出来).我已经阅读了生成XML报告,但对于如何生成报告尚不清楚.任何帮助将不胜感激.

I am new to using Google test framework for unit testing and am intending to generate an XML report of the tests or the command output as a report (I could just print it obviously). I have read up on Generate XML Report , but haven't been able to understand clearly on how to go about generating the report. Any help would be greatly appreciated.

干杯.

推荐答案

我已经提到了v01d的解决方案,并为可能遇到相同问题的其他人提供了完整且框架正确的答案.

I have referred to v01d's solution and just made a complete and properly framed answer for anyone else who might come across the same question.

设置环境变量:

  1. 转到 MyComputer ,右键单击并单击属性.
  2. 点击高级标签,然后点击环境变量.
  3. 单击以添加新变量并通过以下方式设置属性:

  1. Goto MyComputer, right click and click on Properties.
  2. Click on the Advanced Tab, and click on Environment Variables.
  3. Click to Add a new variable and set the properties in the following way:

  • 变量: GTEST_OUTPUT

  • Variable: GTEST_OUTPUT

值: xml:\ home \ user \ XML_Report.xml

Value: xml:\home\user\XML_Report.xml

重新启动MSVC ++,然后再次运行程序.您应该能够在您指定的' Value '属性中提到的相应文件夹中找到XML报表.此外,您甚至可以借助Microsoft Access将xml报告转换成所需的特定格式.此处仅提供了一个简单的教程/示例: XML转换.

Restart your MSVC++ and run your program again. You should be able to find your XML Report in the corresponding folder as mentioned in the 'Value' property specified by you. Furthermore, you can even convert the xml report with the help of Microsoft Access into a particular choice of format you want. Just a simple tutorial/example of this is given here: XML Conversion.

希望这会有所帮助!

这篇关于生成Google C ++单元测试XML报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆