junit插件未显示jenkins中所有测试的结果
我有一个测试套件,其中一些XML文件是在运行单元测试(JUnitTests,junit)后生成的。还有一些其他的量角器自动化测试使用jasmine junit xml reporter()创建xml文件。在jenkins的工作中,我在同一个目录中生成了两组XML文件,我使用junit插件(Publish junit test result report)来发布报告。因此,现在,在作业完成后,单元测试生成9个xml,jasmine reporter生成2个xml,正如下面从我的jenkins作业控制台输出中所述,它能够从我在作业配置中指定的模式中识别出11个xml文件junit插件未显示jenkins中所有测试的结果,jenkins,junit,jasmine-reporters,Jenkins,Junit,Jasmine Reporters,我有一个测试套件,其中一些XML文件是在运行单元测试(JUnitTests,junit)后生成的。还有一些其他的量角器自动化测试使用jasmine junit xml reporter()创建xml文件。在jenkins的工作中,我在同一个目录中生成了两组XML文件,我使用junit插件(Publish junit test result report)来发布报告。因此,现在,在作业完成后,单元测试生成9个xml,jasmine reporter生成2个xml,正如下面从我的jenkins作业控
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 report生成的xml相关的任何结果。需要帮助了解为什么jenkins没有显示任何与jasmine XML相关的测试结果
下面是单元测试生成的示例XML(当单击测试结果链接时,jenkins在ui中显示)
下面是jasmine junit XML reporter生成的示例XML(当单击测试结果链接时,jenkins不会在其UI中显示此结果)
我想你在这里遇到了詹金斯的问题 Jenkins在JUnit XML报告中使用
的属性classname
以及testname
,对UI上的测试结果进行分类。此外,Jenkins希望classname
由包名、单点和类名组成:
<testcase classname="packagename.classname" name="testname">
如果不存在点,Jenkins假定包为“根”。如果存在多个点,则只有最后一个点被识别为分隔符。请参阅以获得更好的解释
如果查看上面的XML报告,您会注意到单元测试的XML在classname
属性中指定了一个包名,而jasmine reporter的XML则没有。我认为缺少包名是测试结果没有显示的原因。显然,如果根本没有包,Jenkins只使用包“root”。如果至少有一个测试用例具有包名,那么没有包的所有其他测试用例都将“丢失”
有两种可能的解决方案:
- 报告Jenkins的错误,因为上述行为是意外的
- 修改jasmine reporter以构造模式
的包.class
。此时有一个pull请求,允许用户函数修改类名classname
<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>
<testcase classname="packagename.classname" name="testname">