Jenkins不从文件输出Junit报告信息 [英] Jenkins Not Outputting Junit Report Info From File

查看:336
本文介绍了Jenkins不从文件输出Junit报告信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Jenkins未获取junit格式的报告,从而导致该报告未在项目的状态屏幕中列出.

A junit-formatted report is not being picked up by Jenkins, causing the reports not to be listed in the project's status screen.

junit格式的报告数据由称为Karma-runner(以前称为Testacular)的测试框架生成.被忽略的文件在/target/surefire-reports中创建-与创建surefire生成的报告的位置相同.报告数据看起来与maven surefire插件生成的数据几乎相同,除了它的父元素是<testsuites>而不是<testsuite>之外-surefire生成的报告作为报告文件的父元素具有<testsuite>.这是业力生成的junit格式的报告的片段,名为TEST-karma.resultsTest.xml:

The junit-formatted report data is generated by a testing framework called Karma-runner (formerly Testacular). The file being ignored is created in /target/surefire-reports -- the same location as where surefire-generated reports are created. The report data looks practically the same as that generated by the maven surefire plugin except that its parent element is <testsuites> instead of <testsuite> -- <testsuite> is what the surefire generated reports have as the parent element of a report file. Here's a snippet from the karma-generated junit-formatted report, named TEST-karma.resultsTest.xml:

Junit格式的业力生成的报告文件,TEST-karma.resultsTest.xml

<?xml version="1.0"?>
<testsuites>
  <testsuite name="PhantomJS 1.9 (Mac)" package="karma.tests" timestamp="2013-04-10T13:32:26" id="0" hostname="jgmbp.local" tests="16" errors="0" failures="0" time="0.069">
    <properties>
      <property name="browser.fullName" value="Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.0 Safari/534.34"/>
    </properties>
    <testcase name="successfully cancels a new member" time="0.006" classname="karma.tests PhantomJS 1.9 (Mac).Household Controller"/>
    <testcase name="should parse an existing re-eval create date, setting the data in scope" time="0.003" classname="karma.tests PhantomJS 1.9 (Mac).Re-Eval Controller"/>
    <system-out><![CDATA[
]]></system-out>
    <system-err/>
  </testsuite>
</testsuites>

Karma测试在我的Maven构建的测试阶段中运行.我尝试创建仅生成此junit-report文件的项目,并运行构建,以便所有junit测试和业力测试都生成报告文件.詹金斯将始终接受surefire测试,但不会进行业力测试.

The Karma tests are run during the test phase of my maven build. I've tried creating projects that only produce this one junit-report file as well as running the build so that all junit tests and karma tests generate report files. Jenkins will always pick up the surefire tests, but never the karma tests.

感谢您的任何输入!

推荐答案

感谢amey和Wouter的帮助,终于有时间弄清楚了.

Finally had the time to figure it out, thanks to amey and Wouter's input.

关键是我正在构建一个Maven项目,并且无法显示业力测试.显示业力结果的唯一方法是为Junit测试添加构建后报告.由于某些原因,基于Maven的作业无法为您提供添加junit报告的选项.

The key is that I'm building a maven project, and that won't work with displaying the karma tests. The only way to display karma results is to add a post build report for Junit tests. For some reason, maven-based jobs do not give you the option to add a junit report.

解决方案是创建自由格式的作业,而不是maven作业.您可以配置自由格式作业来构建Maven项目.只要您在上面每个amey的帖子中添加publishing junit任务,一切都很好.

The solution is to create a free form job instead of a maven job. You can configure the free form job to build the maven project just fine. As long as you add the publish junit task per amey's post above, all is well.

这篇关于Jenkins不从文件输出Junit报告信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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