我正在使用Jenkins,Maven 3.1和Java 1.6。我在詹金斯(Jenkins)建立了以下Maven职位,并具有以下目标和选择…
clean install -U -P cloudbees -P qa
下面是我的pom.xml surefire配置…
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<reuseForks>true</reuseForks>
<argLine>-Xmx2048m -XX:MaxPermSize=512M </argLine>
<skipTests>false</skipTests>
</configuration>
</plugin>
但是,当我的单元测试失败时,Jenkins控制台输出仍然显示“ BUILD
SUCCESS”,并且该构建被标记为“不稳定”,而不是完全失败。我如何在Jenkins(如果事实如此,则为Maven)中配置事物,以便在任何单元测试失败时我的构建失败(不会变得不稳定或通过)?
以下是控制台输出的内容
17:08:04 MyProjectOrganizationControllerTest.testRecoverFromError » IllegalState Failed to...
17:08:04 MyProjectOrganizationControllerTest.testVerifyDistrictListPopulated » IllegalState
17:08:04 MyProjectOrganizationControllerTest.testUpdateSchool » IllegalState Failed to loa...
17:08:04 MyProjectOrganizationControllerTest.testDeleteSchool » IllegalState Failed to loa...
17:08:04 MyProjectOrganizationControllerTest.testVerifyOrgListPopulatedPrivateSchoolOrgType » IllegalState
17:08:04 MyProjectOrganizationControllerTest.testSubmitMultipleParams » IllegalState Faile...
17:08:04
17:08:04 Tests run: 155, Failures: 0, Errors: 154, Skipped: 1
17:08:04
17:08:04 [ERROR] There are test failures.
17:08:04
17:08:04 Please refer to /scratch/jenkins/workspace/MyProject/MyProject/target/surefire-reports for the individual test results.
17:08:04 [JENKINS] Recording test results
17:08:07 log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
17:08:07 log4j:WARN Please initialize the log4j system properly.
17:08:14 [INFO]
17:08:14 [INFO] --- maven-war-plugin:2.4:war (default-war) @ MyProject ---
17:08:15 [INFO] Packaging webapp
17:08:15 [INFO] Assembling webapp [MyProject] in [/scratch/jenkins/workspace/MyProject/MyProject/target/MyProject]
17:08:15 [INFO] Processing war project
17:08:15 [INFO] Copying webapp resources [/scratch/jenkins/workspace/MyProject/MyProject/src/main/webapp]
17:08:15 [INFO] Webapp assembled in [662 msecs]
17:08:15 [INFO] Building war: /scratch/jenkins/workspace/MyProject/MyProject/target/MyProject.war
17:08:20 [INFO]
17:08:20 [INFO] --- maven-failsafe-plugin:2.17:integration-test (default) @ MyProject ---
17:08:20 [JENKINS] Recording test results
17:08:25 [INFO]
17:08:25 [INFO] --- maven-failsafe-plugin:2.17:verify (default) @ MyProject ---
17:08:25 [INFO] Failsafe report directory: /scratch/jenkins/workspace/MyProject/MyProject/target/failsafe-reports
17:08:25 [JENKINS] Recording test results[INFO]
17:08:25 [INFO] --- maven-install-plugin:2.4:install (default-install) @ MyProject ---
17:08:25
17:08:25 [INFO] Installing /scratch/jenkins/workspace/MyProject/MyProject/target/MyProject.war to /home/jenkins/.m2/repository/org/mainco/subco/MyProject/76.0.0-SNAPSHOT/MyProject-76.0.0-SNAPSHOT.war
17:08:25 [INFO] Installing /scratch/jenkins/workspace/MyProject/MyProject/pom.xml to /home/jenkins/.m2/repository/org/mainco/subco/MyProject/76.0.0-SNAPSHOT/MyProject-76.0.0-SNAPSHOT.pom
17:08:26 Started calculate disk usage of build
17:08:26 Finished Calculation of disk usage of build in 0 seconds
17:08:26 Started calculate disk usage of workspace
17:08:26 Finished Calculation of disk usage of workspace in 0 seconds
17:08:26 [INFO] ------------------------------------------------------------------------
17:08:26 [INFO] BUILD SUCCESS
17:08:26 [INFO] ------------------------------------------------------------------------
17:08:26 [INFO] Total time: 11:00.616s
17:08:26 [INFO] Finished at: Mon Feb 23 17:08:26 UTC 2015
17:08:27 [INFO] Final Memory: 90M/414M
17:08:27 [INFO] ------------------------------------------------------------------------
17:08:27 Waiting for Jenkins to finish collecting data
17:08:28 [JENKINS] Archiving /scratch/jenkins/workspace/MyProject/MyProject/pom.xml to org.mainco.subco/MyProject/76.0.0-SNAPSHOT/MyProject-76.0.0-SNAPSHOT.pom
17:08:28 [JENKINS] Archiving /scratch/jenkins/workspace/MyProject/MyProject/target/MyProject.war to org.mainco.subco/MyProject/76.0.0- SNAPSHOT/MyProject-76.0.0-SNAPSHOT.war
17:08:31 channel stopped
17:08:31 Started calculate disk usage of build
17:08:31 Finished Calculation of disk usage of build in 0 seconds
17:08:31 Started calculate disk usage of workspace
17:08:31 Finished Calculation of disk usage of workspace in 0 seconds
17:08:31 Finished: UNSTABLE
如果您单击Jenkins
Job的Build部分中的Advanced按钮,则可以添加-Dmaven.test.failure.ignore=false
到中MAVEN_OPTS
。
请参阅Maven Surefire插件-surefire:test选项以供参考。
我使用的是Jenkins、Maven3.1和Java1.6。我有以下的Maven工作设置在詹金斯与以下目标和选择...
我已经设置了一个Jenkins服务器来运行Selenium测试。构建脚本是用Ant(CentOS 6.3上的V1.7.1)编写的,测试在Sauce实验室上运行。我通过shell执行构建:
问题内容: 我已经设置了一个Jenkins服务器来运行Selenium测试。生成脚本是用Ant(CentOS 6.3上的v 1.7.1)编写的,并且测试在Sauce Labs上运行。我通过外壳执行构建: 问题是测试失败时,詹金斯(Jenkins)将其标记为成功。我可以通过将设置为来避免这种情况,请参阅: 但是,这并不理想,因为Jenkins会在遇到第一个故障时终止构建。构建完成后是否可以检查失败,
----maven-enforcer-plugin:1.0.1:enforce(default)@cli---添加ignore:org.eclipse.jetty.spdy.* ----maven-enforcer-plugin:1.0.1:enforce(enforce-bang-dependencies)@cli-- ---build-helper-maven-plugin:1.7:times
我正在jenkins上运行一组测试,我得到以下结果: 好的东西告诉我行: maven-surefire-插件: 2.16是这里的问题,所以这里是我的pom文件检查: 我已经检查了maven仓库中的插件,我看到的唯一区别是插件标签中有插件,而在网站中它是在依赖标签中。 这里可能有什么错误? 谢谢 注:抱歉纯文本,但我不知道如何给代码上色=/
我们有一组UI测试每晚运行,有时一些测试由于网络故障而失败。为了避免假阴性测试结果,我使用了,它可以重新运行失败的测试多达3次。 当我从Eclispe右键单击套件运行测试时,它工作得非常好。xml—如果测试最初失败,但重试时通过,则第一个结果不算作失败。 但是,当作为Maven构建的一部分运行相同的测试时,如果任何测试失败,即使在重试时成功通过,构建也会失败。 例如,运行一个包含5个测试的套件,其