Jenkins、Junit 和 Flaky 测试处理程序插件
Jenkins, Junit and Flaky Test Handler plugin
我正在尝试在 Jenkins 中获得易碎测试的可见性 运行ning。
为此我安装了 https://wiki.jenkins-ci.org/display/JENKINS/Flaky+Test+Handler+Plugin 似乎有这个目的。
我的安装满足插件页面中指定的所有要求(Jenkins 版本、Junit 插件等...)
安装插件后,提示
check on “Publish JUnit flaky test reports” under “Additional test
report features.
他们的截图显示
我的 Maven 项目 配置没有给我指定 测试报告 XMLs 的选项,而是如下所示:
虽然,当我 运行 为配置的项目构建 Jenkins 时,我得到的只是一个空 table:
项目配置的 Build 部分正在使用 -Dsurefire.rerunFailingTestsCount=3
选项。
我有点困惑是插件不适合我的 Jenkins 安装还是我遗漏了什么。
编辑:我一直在尝试 1.0.3 版,其中包含其中一个答案中提到的修复程序,并且在作业执行结束时出现以下错误:
ERROR: Publisher 'Publish JUnit test result report' aborted due to exception:
java.io.IOException: Unable to serialize com.google.jenkins.flakyTestHandler.junit.FlakyTestResult@55c1d6e9
at hudson.remoting.UserRequest.serialize(UserRequest.java:169)
at hudson.remoting.UserRequest.perform(UserRequest.java:129)
at hudson.remoting.UserRequest.perform(UserRequest.java:49)
at hudson.remoting.Request.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at ......remote call to some.slave.com(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1413)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:221)
at hudson.remoting.Channel.call(Channel.java:778)
at com.google.jenkins.flakyTestHandler.plugin.JUnitFlakyTestDataPublisher.getTestData(JUnitFlakyTestDataPublisher.java:49)
at hudson.tasks.junit.TestDataPublisher.contributeTestData(TestDataPublisher.java:62)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:166)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:75)
at hudson.tasks.BuildStepMonitor.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
at hudson.model.Run.execute(Run.java:1766)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:408)
Caused by: java.io.NotSerializableException: com.google.jenkins.flakyTestHandler.junit.FlakyCaseResult$FlakyRunInformation
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at java.util.ArrayList.writeObject(ArrayList.java:762)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at java.util.ArrayList.writeObject(ArrayList.java:762)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at java.util.ArrayList.writeObject(ArrayList.java:762)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at hudson.remoting.UserRequest._serialize(UserRequest.java:158)
at hudson.remoting.UserRequest.serialize(UserRequest.java:167)
at hudson.remoting.UserRequest.perform(UserRequest.java:129)
at hudson.remoting.UserRequest.perform(UserRequest.java:49)
at hudson.remoting.Request.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
这似乎只有在从机上执行作业时才会发生,它似乎在主机上运行良好。
编辑 2:1.0.4 修复了上述问题。
编辑 3:尽管 1.0.4 修复了序列化问题,但插件报告似乎仍然存在问题。例如以下情况:
- 作业 #21 运行 成功
- 工作 #22 运行 并进行了一次不稳定的测试,第二次通过了测试 运行
- 作业 #23 运行 成功
该项目的报告说有一个 1 个 Flakes 的 flaky test,0 个 Fails 和 0 个 Passes。我希望 2 次通过,0 次失败和 1 次失败。
我是不是漏掉了什么?
我遇到了同样的问题。查看 master 日志后发现,该插件并不期望构建在 slave 上执行。有为我解决问题的拉取请求 - https://github.com/jenkinsci/flaky-test-handler-plugin/pull/2
如果我没记错的话,我们将一个不稳定的测试定义为:
对于相同的代码修改,它既失败又通过。
因此,如果您从不修改代码,即使您运行 修改了 100 次,结果是 50 次通过和 50 次失败,我们仍然将其视为一个薄片;如果全部通过100次,则算一次通过;否则100次都失败就是一次失败
如果您进行了一些更改并提交了另一个版本,然后在此基础上进行构建,那么它将是一个新号码。
相信大家点击测试,就能看到详细的passes/fails,是你想要的吗?
见https://wiki.jenkins-ci.org/display/JENKINS/Flaky+Test+Handler+Plugin
“ 汇总修订的测试统计数据 ”
我正在尝试在 Jenkins 中获得易碎测试的可见性 运行ning。
为此我安装了 https://wiki.jenkins-ci.org/display/JENKINS/Flaky+Test+Handler+Plugin 似乎有这个目的。
我的安装满足插件页面中指定的所有要求(Jenkins 版本、Junit 插件等...)
安装插件后,提示
check on “Publish JUnit flaky test reports” under “Additional test report features.
他们的截图显示
我的 Maven 项目 配置没有给我指定 测试报告 XMLs 的选项,而是如下所示:
虽然,当我 运行 为配置的项目构建 Jenkins 时,我得到的只是一个空 table:
项目配置的 Build 部分正在使用 -Dsurefire.rerunFailingTestsCount=3
选项。
我有点困惑是插件不适合我的 Jenkins 安装还是我遗漏了什么。
编辑:我一直在尝试 1.0.3 版,其中包含其中一个答案中提到的修复程序,并且在作业执行结束时出现以下错误:
ERROR: Publisher 'Publish JUnit test result report' aborted due to exception:
java.io.IOException: Unable to serialize com.google.jenkins.flakyTestHandler.junit.FlakyTestResult@55c1d6e9
at hudson.remoting.UserRequest.serialize(UserRequest.java:169)
at hudson.remoting.UserRequest.perform(UserRequest.java:129)
at hudson.remoting.UserRequest.perform(UserRequest.java:49)
at hudson.remoting.Request.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at ......remote call to some.slave.com(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1413)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:221)
at hudson.remoting.Channel.call(Channel.java:778)
at com.google.jenkins.flakyTestHandler.plugin.JUnitFlakyTestDataPublisher.getTestData(JUnitFlakyTestDataPublisher.java:49)
at hudson.tasks.junit.TestDataPublisher.contributeTestData(TestDataPublisher.java:62)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:166)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:75)
at hudson.tasks.BuildStepMonitor.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
at hudson.model.Run.execute(Run.java:1766)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:408)
Caused by: java.io.NotSerializableException: com.google.jenkins.flakyTestHandler.junit.FlakyCaseResult$FlakyRunInformation
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at java.util.ArrayList.writeObject(ArrayList.java:762)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at java.util.ArrayList.writeObject(ArrayList.java:762)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at java.util.ArrayList.writeObject(ArrayList.java:762)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at hudson.remoting.UserRequest._serialize(UserRequest.java:158)
at hudson.remoting.UserRequest.serialize(UserRequest.java:167)
at hudson.remoting.UserRequest.perform(UserRequest.java:129)
at hudson.remoting.UserRequest.perform(UserRequest.java:49)
at hudson.remoting.Request.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
这似乎只有在从机上执行作业时才会发生,它似乎在主机上运行良好。
编辑 2:1.0.4 修复了上述问题。
编辑 3:尽管 1.0.4 修复了序列化问题,但插件报告似乎仍然存在问题。例如以下情况:
- 作业 #21 运行 成功
- 工作 #22 运行 并进行了一次不稳定的测试,第二次通过了测试 运行
- 作业 #23 运行 成功
该项目的报告说有一个 1 个 Flakes 的 flaky test,0 个 Fails 和 0 个 Passes。我希望 2 次通过,0 次失败和 1 次失败。
我是不是漏掉了什么?
我遇到了同样的问题。查看 master 日志后发现,该插件并不期望构建在 slave 上执行。有为我解决问题的拉取请求 - https://github.com/jenkinsci/flaky-test-handler-plugin/pull/2
如果我没记错的话,我们将一个不稳定的测试定义为:
对于相同的代码修改,它既失败又通过。
因此,如果您从不修改代码,即使您运行 修改了 100 次,结果是 50 次通过和 50 次失败,我们仍然将其视为一个薄片;如果全部通过100次,则算一次通过;否则100次都失败就是一次失败
如果您进行了一些更改并提交了另一个版本,然后在此基础上进行构建,那么它将是一个新号码。
相信大家点击测试,就能看到详细的passes/fails,是你想要的吗?
见https://wiki.jenkins-ci.org/display/JENKINS/Flaky+Test+Handler+Plugin “ 汇总修订的测试统计数据 ”