double unit test reporting with hudson and maven

时光总嘲笑我的痴心妄想 提交于 2019-12-03 13:11:58

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

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.

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. Install "Hudson M2 Extra Steps Plugin"
  3. Configure your Hudson job as Maven 2 project
  4. In your job configuration in the "Build" section configure usual clean/install goals
  5. 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"
  6. In "Post-build Actions" select "Publish Cobertura Coverage Report" and configure proper xml report pattern (default should work just fine)

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!