用哈德森和maven进行双单元测试报告

时间:2021-10-18 23:55:23

I have a maven2 project in hudson and when the cobertura reporting plugin runs, it causes the unit tests to show that they have run twice. I don't mind them running multiple times, but the trend graph shows twice as many tests as we actually are running. Is there a way to make sure the graph only shows them once?

我在哈德森有一个maven2项目,当cobertura报告插件运行时,它会导致单元测试显示它们已经运行了两次。我不介意他们多次运行,但趋势图显示的测试次数是我们实际运行的两倍。有没有办法确保图表只显示一次?

thanks,

Jeff

3 个解决方案

#1


This is a known bug. Just wait for it to be fixed.

这是一个已知的错误。等待它修复。

#2


The workaround I use (works in Hudson 1.391) is to configure cobertura in separate Maven profile and run it in a Hudson job as a post-build step.

我使用的解决方法(在Hudson 1.391中工作)是在单独的Maven配置文件中配置cobertura,并在Hudson作业中将其作为构建后步骤运行。

Mode detailed instructions:

模式详细说明:

  1. Add cobertura to your project pom in a special profile (so it won't run while default lifecycle) and configure it to create report in xml format.
  2. 在特殊配置文件中将cobertura添加到项目pom中(因此在默认生命周期中不会运行)并将其配置为以xml格式创建报告。

  3. Install "Hudson M2 Extra Steps Plugin"
  4. 安装“Hudson M2 Extra Steps插件”

  5. Configure your Hudson job as Maven 2 project
  6. 将Hudson作业配置为Maven 2项目

  7. In your job configuration in the "Build" section configure usual clean/install goals
  8. 在“构建”部分的作业配置中,配置常用的清理/安装目标

  9. In "Build Environment" section select "Configure M2 Extra Build Steps" and add Maven post-build step. Configure it to run "cobertura:cobertura -P your_cobertura_profile_name"
  10. 在“构建环境”部分中,选择“配置M2额外构建步骤”并添加Maven构建后步骤。配置它运行“cobertura:cobertura -P your_cobertura_profile_name”

  11. In "Post-build Actions" select "Publish Cobertura Coverage Report" and configure proper xml report pattern (default should work just fine)
  12. 在“Post-build Actions”中选择“Publish Cobertura Coverage Report”并配置正确的xml报告模式(默认应该可以正常工作)

#3


I had the same problem recently when I was running maven goals test and emma:emma on the same job. emma seems to have rerun all tests thus doubling the results. When I removed goal test my unit tests still got executed but test results went back to normal. Could be the same with cobertura.

最近,当我在同一个工作上运行maven目标测试和emma:emma时,我遇到了同样的问题。艾玛似乎已经重新运行所有测试,从而使结果翻倍。当我删除目标测试时,我的单元测试仍然执行但测试结果恢复正常。可能和cobertura一样。

#1


This is a known bug. Just wait for it to be fixed.

这是一个已知的错误。等待它修复。

#2


The workaround I use (works in Hudson 1.391) is to configure cobertura in separate Maven profile and run it in a Hudson job as a post-build step.

我使用的解决方法(在Hudson 1.391中工作)是在单独的Maven配置文件中配置cobertura,并在Hudson作业中将其作为构建后步骤运行。

Mode detailed instructions:

模式详细说明:

  1. Add cobertura to your project pom in a special profile (so it won't run while default lifecycle) and configure it to create report in xml format.
  2. 在特殊配置文件中将cobertura添加到项目pom中(因此在默认生命周期中不会运行)并将其配置为以xml格式创建报告。

  3. Install "Hudson M2 Extra Steps Plugin"
  4. 安装“Hudson M2 Extra Steps插件”

  5. Configure your Hudson job as Maven 2 project
  6. 将Hudson作业配置为Maven 2项目

  7. In your job configuration in the "Build" section configure usual clean/install goals
  8. 在“构建”部分的作业配置中,配置常用的清理/安装目标

  9. In "Build Environment" section select "Configure M2 Extra Build Steps" and add Maven post-build step. Configure it to run "cobertura:cobertura -P your_cobertura_profile_name"
  10. 在“构建环境”部分中,选择“配置M2额外构建步骤”并添加Maven构建后步骤。配置它运行“cobertura:cobertura -P your_cobertura_profile_name”

  11. In "Post-build Actions" select "Publish Cobertura Coverage Report" and configure proper xml report pattern (default should work just fine)
  12. 在“Post-build Actions”中选择“Publish Cobertura Coverage Report”并配置正确的xml报告模式(默认应该可以正常工作)

#3


I had the same problem recently when I was running maven goals test and emma:emma on the same job. emma seems to have rerun all tests thus doubling the results. When I removed goal test my unit tests still got executed but test results went back to normal. Could be the same with cobertura.

最近,当我在同一个工作上运行maven目标测试和emma:emma时,我遇到了同样的问题。艾玛似乎已经重新运行所有测试,从而使结果翻倍。当我删除目标测试时,我的单元测试仍然执行但测试结果恢复正常。可能和cobertura一样。