double unit test reporting with hudson and maven
Asked Answered
C

3

8

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?

thanks,

Jeff

Christianechristiania answered 8/7, 2009 at 14:25 Comment(2)
it turns out this is only a problem when using a maven2 project and not a freestyle projectChristianechristiania
Still not solved on hudson :-( issues.hudson-ci.org/browse/HUDSON-1557Ikeda
S
4

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

Secundines answered 15/9, 2009 at 15:51 Comment(1)
The new URL of this issue is issues.hudson-ci.org/browse/HUDSON-2068 and also this related/dup: issues.hudson-ci.org/browse/HUDSON-1557Thursby
S
1

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)
Selfabuse answered 4/1, 2011 at 17:7 Comment(0)
T
0

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.

Tushy answered 8/7, 2009 at 19:14 Comment(1)
That probably would work, but that will result in only the instrumented unit tests running. The build really should be running both the instrumented and uninstrumented. I found that switching to a free-style project (although I lost some of the benefits of the maven2 project) behaves a lot better. The trend graphs show up properly and tests are not double counted (even though they are run twice).Christianechristiania

© 2022 - 2024 — McMap. All rights reserved.