包括运行JUnit测试作为Jenkins配置的一部分

时间:2015-04-15 15:30:47

标签: java ant jenkins

我试图将Jenkins配置为包含Post Build步骤以运行JUnit测试并收到错误:

Jenkins步骤本身就显示出一个问题:

target/surefire-reports/*.xml
‘target/surefire-reports/*.xml’ doesn’t match anything, but ‘*.xml’ does. Perhaps that’s what you mean?

这并不令人惊讶,因为我没有在目标下有一个surefire-reports子文件夹,我不知道我要做什么来生成xml报告。我是Java,Maven,Eclipse,Linux的新手 - 一切 - 并且独自工作。

我的主要问题是:

这种配置是否表明我必须考虑使用ANT集成?我甚至不知道我应该阅读的缩略词是什么,我希望有一些方向要削减曲线。

我看到了设置此帖子构建步骤的内部说明,但现在我需要知道如何使其工作。

由于

INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ FDE ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.445 s
[INFO] Finished at: 2015-04-15T10:59:18-04:00
[INFO] Final Memory: 16M/38M
[INFO] ------------------------------------------------------------------------
Changing BUILD_ID variable (job build time) with the date pattern MM/dd/yyyy hh:mm a.
Recording test results
Changing BUILD_ID variable (job build time) with the date pattern MM/dd/yyyy hh:mm a.
No test report files were found. Configuration error?
Build step 'Publish JUnit test result report' changed build result to FAILURE
Checking for post-build
Performing post-build step
Checking if email needs to be generated
Email was triggered for: Failure
Sending email for trigger: Failure
Overriding default server settings, creating our own session
Changing BUILD_ID variable (job build time) with the date pattern MM/dd/yyyy hh:mm a.
Changing BUILD_ID variable (job build time) with the date pattern MM/dd/yyyy hh:mm a.
messageContentType = text/html; charset=UTF-8
Changing BUILD_ID variable (job build time) with the date pattern MM/dd/yyyy hh:mm a.
Adding developers
Changing BUILD_ID variable (job build time) with the date pattern MM/dd/yyyy hh:mm a.
Setting In-Reply-To since last build was not successful
Successfully created MimeMessage
Sending email to: John.Doe@MyCom.com
Changing BUILD_ID variable (job build time) with the date pattern MM/dd/yyyy hh:mm a.
Warning: you have no plugins providing access control for builds, so falling back to legacy behavior of permitting any downstream builds to be triggered
Notifying upstream projects of job completion
Finished: FAILURE

enter image description here

1 个答案:

答案 0 :(得分:1)

用于生成JUnit报告的Ant任务。将<junitreport>任务添加到Ant构建中,并使其依赖于<junit>任务。