为什么我的 Sonar Jenkins 工作即使测试失败也不会变得不稳定?
我在詹金斯有一份每晚都运行的工作。在此构建期间执行的任务是:编译、单元测试、集成测试(这只是比“实际单元测试”执行时间更长的 JUnit 测试)和 Sonar 质量分析。
然而,当测试失败时,作业将被视为成功,因此不会发送电子邮件来通知此失败。
使用的 Maven 命令是 mvn clean install sonar:sonar
。删除 install
目标不会改变任何内容。
这有什么问题吗?
有没有一种方法可以只用一个 Jenkins 作业来获得预期的行为(即测试失败时构建不稳定),或者我应该创建两个作业,一个用于整个“Java 部分”(编译、单元测试和集成测试) ,还有一个用于声纳分析?
我们使用 Maven 2.0.9、Java 1.6、Sonar 2.8、Jenkins 1.413。
I have a job in Jenkins that is run every night. The tasks executed during this build are: compilation, unit tests, integration tests (which are only JUnit tests which are longer than "real unit tests" to execute), and Sonar quality analysis.
When a test fails, the job is however considered as successfull and thus, no email is sent to notify this failure.
The Maven command used is mvn clean install sonar:sonar
. Removing the install
goal does not change anything.
What is wrong with that?
Is there a way to get the expected behavior (i.e. having an unstable build when a test failed) with only one Jenkins job, or should I create two jobs, one for the whole "Java part" (compile, unit test and integration tests), and one for the Sonar analysis?
We are using Maven 2.0.9, Java 1.6, Sonar 2.8, Jenkins 1.413.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Jenkins 似乎设置了该属性: Hudson 构建成功但单元测试失败
使用属性(-Dmaven.test.failure.ignore=false),当测试失败时,构建会停止。
有一个用于声纳的 jenkins 插件:
即使测试失败,这似乎也会进行分析: http://jira.codehaus.org/browse/SONARPLUGINS -461
在我的声纳安装中,我与声纳分开运行测试并重用 junit/surefire 报告。这样我就可以独立于声纳控制测试。
Jenkins seems to set that property: Hudson build successful with unit test failures
With the property (-Dmaven.test.failure.ignore=false), when there is a test failure, the build stops.
There is a jenkins plugin for sonar:
That seems to analyze even if Tests fails: http://jira.codehaus.org/browse/SONARPLUGINS-461
In my sonar installation, I run the tests seperate from sonar and reuse the junit/surefire reports. That way I can control the tests independently from sonar.