如何导入谷歌测试xml结果到VSTS

How to import Google Tests xml results to VSTS

本文关键字:xml 测试 结果 VSTS 谷歌 何导入 导入      更新时间:2023-10-16

我们在基于c++的解决方案中使用Google Test (gtest)进行测试。我们在VSTS中构建它,以便在Windows上运行。当我们运行test .exe时,它产生test_detail.xml文件,包含测试运行的结果:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1152" failures="0" disabled="0" errors="0" time="8.57" name="AllTests">
  <testsuite name="testTrim" tests="10" failures="0" disabled="0" errors="0" time="0.041">
    <testcase name="trimEmptyString" status="run" time="0" classname="testTrim" />
...

如何将此文件导入VSTS?

如果gtest被识别并显示在构建摘要页面上,即使它只是通过失败,没有错误的细节,这将是理想的。

原来test_detail.xml (gtest生成的报告)的格式是JUnit,所以很容易导入到VSTS中,如下所示:https://www.visualstudio.com/en-us/docs/test/continuous-testing/getting-started/continuous-test-java