为什么 Jenkins 不正确地解析我的 JUnit 报告?

Why is Jenkins improperly parsing my JUnit report?

我有一个 Jenkins 作业,每次我将代码推送到我的存储库时都会 运行。这项工作的最后一步是 运行 一系列 behat 测试。这些测试同时输出 "pretty" 格式化程序和 jUnit 格式化程序。 jUnit XML 如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="default">
  <testsuite name="Confirm that the theme is enabled" tests="1" skipped="0" failures="0" errors="0">
    <testcase name="Make sure all drupal regions are present on the homepage" status="passed"></testcase>
  </testsuite>
  <testsuite name="Confirm that Drupal installed" tests="2" skipped="0" failures="0" errors="0">
    <testcase name="Look for a body element on the homepage" status="passed"></testcase>
    <testcase name="Make sure users can login" status="passed"></testcase>
  </testsuite>
  <testsuite name="Validate API" tests="2" skipped="0" failures="0" errors="0">
    <testcase name="Show that service is available at /api/v1." status="passed"></testcase>
    <testcase name="Make sure the the api/v1/page_wrapper response is valid" status="passed"></testcase>
  </testsuite>
  <testsuite name="Confirm main menu has installed properly." tests="1" skipped="0" failures="0" errors="0">
    <testcase name="Confirm the main menu links are present." status="passed"></testcase>
  </testsuite>
</testsuites>

到目前为止一切顺利。问题是最后一个测试,"Confirm main menu has installed properly." 这是最近添加的,它的行为与其他测试不同。它是唯一一个在测试结果概览页面上显示为根元素的同级元素。也就是说,当我点击 "test results" 时,我看到了这个:

当我点击 (root) 时,我会看到所有其他测试结果。但是当我点击 "Confirm main menu has installed properly" 时,我看到了这个:

这毫无意义,甚至不包括我的测试用例。给出了什么?

进一步查看,问题出在上次测试结果中包含的句号(.)字符!我刚刚删除了句号,一切正常!