This is related to another question I asked about trying to fail Hudson on a single unit test failure.
这与我在单个单元测试失败时尝试使Hudson失败的另一个问题有关。
When I run Maven on my build standalone, it fails due to unit test errors (running mvn clean install
) but when I run it in Hudson, it says there was an error due to test failure, yet the build still is successful (and marked as unstable). Any thoughts?
当我在我的构建独立运行Maven时,由于单元测试错误(运行mvn clean install)而失败但是当我在Hudson中运行它时,它说由于测试失败而出现错误,但构建仍然成功(并标记不稳定)。有什么想法吗?
4 个解决方案
#1
What type of Hudson job did you create? I suspect it's the m2 project rather than the freestyle project. In the m2 project, Hudson will actually tweak the way your pom is configured so as to prevent failures and instead mark it as unstable. This was intentional.
你创造了什么类型的哈德森工作?我怀疑这是m2项目而不是*式项目。在m2项目中,Hudson实际上会调整你的pom的配置方式,以防止失败,并将其标记为不稳定。这是故意的。
Try setting maven.test.failure.ignore=false
under the Advanced setting as I believe Hudson automatically sets that to true
.
尝试在高级设置下设置maven.test.failure.ignore = false,因为我相信Hudson会自动将其设置为true。
#2
Hudson's convention is that it will only look for tests if the build returned success. If the build failed hudson interprets that to mean there was some unrecoverable error that caused the build to not work, and not that there were some tests that failed.
Hudson的惯例是它只会在构建返回成功时查找测试。如果构建失败,hudson会将其解释为意味着存在一些不可恢复的错误导致构建不起作用,而不是某些测试失败。
It's quite useful differential as thus unstable (yellow) means the build completed and the tests were all able to run, but some failed.
这是非常有用的差异因为不稳定(黄色)意味着构建完成并且测试都能够运行,但有些失败了。
And error means that the build failed in that it couldn't compile or that there was some other unrecoverable error that caused the tests not to run, in this case hudson won't report on the unit test state.
并且错误意味着构建失败,因为它无法编译或者存在导致测试不运行的其他一些不可恢复的错误,在这种情况下,hudson将不会报告单元测试状态。
#3
there are also hudson options in each job's config to determine how to act if a build becomes unstable, such as whether or not to send emails, etc.
每个作业的配置中还有hudson选项,用于确定构建变得不稳定时如何操作,例如是否发送电子邮件等。
#1
What type of Hudson job did you create? I suspect it's the m2 project rather than the freestyle project. In the m2 project, Hudson will actually tweak the way your pom is configured so as to prevent failures and instead mark it as unstable. This was intentional.
你创造了什么类型的哈德森工作?我怀疑这是m2项目而不是*式项目。在m2项目中,Hudson实际上会调整你的pom的配置方式,以防止失败,并将其标记为不稳定。这是故意的。
Try setting maven.test.failure.ignore=false
under the Advanced setting as I believe Hudson automatically sets that to true
.
尝试在高级设置下设置maven.test.failure.ignore = false,因为我相信Hudson会自动将其设置为true。
#2
Hudson's convention is that it will only look for tests if the build returned success. If the build failed hudson interprets that to mean there was some unrecoverable error that caused the build to not work, and not that there were some tests that failed.
Hudson的惯例是它只会在构建返回成功时查找测试。如果构建失败,hudson会将其解释为意味着存在一些不可恢复的错误导致构建不起作用,而不是某些测试失败。
It's quite useful differential as thus unstable (yellow) means the build completed and the tests were all able to run, but some failed.
这是非常有用的差异因为不稳定(黄色)意味着构建完成并且测试都能够运行,但有些失败了。
And error means that the build failed in that it couldn't compile or that there was some other unrecoverable error that caused the tests not to run, in this case hudson won't report on the unit test state.
并且错误意味着构建失败,因为它无法编译或者存在导致测试不运行的其他一些不可恢复的错误,在这种情况下,hudson将不会报告单元测试状态。
#3
there are also hudson options in each job's config to determine how to act if a build becomes unstable, such as whether or not to send emails, etc.
每个作业的配置中还有hudson选项,用于确定构建变得不稳定时如何操作,例如是否发送电子邮件等。
#4
just saw this defect is reported on the Hudson Bugtracker
刚刚看到Hudson Bugtracker报道了这个缺陷