我有一个测试套件,其中一些 XML 文件是在运行单元测试 (junit) 后生成的。还有一些其他量角器自动化测试使用 jasmine junit xml 报告器(https://github.com/larrymyers/jasmine-reporters)来创建 XML 文件。我在 jenkins 工作的同一目录中生成两组 XML 文件,我使用了 junit 插件(发布 JUnit 测试结果报告)来发布报告。因此,现在,在作业完成后,单元测试生成了 9 个 xml,jasmine-reporter 生成了 2 个 XML,如下所述,从我的 jenkins 作业控制台输出中,它能够识别出有 11 个 xml 文件来自我在作业配置中指定的模式。
22:49:52 [xUnit] [INFO] - [JUnit] - 11 test report file(s) were found with the
pattern '**/tests/target/failsafe-reports/junitreports/*.xml' relative to
'/home/jenkins/workspace/projectName' for the testing framework
'JUnit'.
但是,问题是,当我单击 jenkins 作业 UI 中的“测试结果”链接时,它只显示与单元测试生成的 xml 相关的所有测试,并且不显示与从 jasmine 报告生成的 XML 相关的任何结果。需要帮助来了解为什么 jenkins 没有显示任何与 jasmine XML 相关的测试结果。
下面是一个由单元测试生成的示例 XML(当点击测试结果链接时,jenkins 在 ui 中显示)。
<!--
Generated by org.testng.reporters.JUnitReportReporter
-->
<testsuite hostname="someHostName"
name="packageName.Class1" tests="22" failures="0" timestamp="16
Apr 2018 05:47:59 GMT" time="69.663" errors="0">
<testcase name="test1" time="2.488"
classname="packageName.Class1"/>
<testcase name="test2" time="5.808"
classname="packageName.Class1"/>
</testsuite>
下面是由 jasmine junit xml 报告器生成的示例 XML(当单击测试结果链接时,jenkins 在其 UI 中未显示此结果)
<testsuites>
<testsuite name="chromeTestItemDetailsPage" timestamp="2018-04-16T05:48:43"
hostname="localhost" time="29.357" errors="0" tests="22" skipped="0"
disabled="0" failures="0">
<testcase classname="chromeTestItemDetailsPage" name="ItemTitleDisplayed"
time="0.895"/>
<testcase classname="chromeTestItemDetailsPage" name="ItemPriceDisplayed"
time="0.966"/>
</testsuite>
</testsuites>