|
Hi,
Is there any way to configure the way cobertura runs with Sonar (or another code coverage tool that Sonar supports for that matter). We have two recurrent use cases: * if (logger.isDebugEnabled) that lowers our line coverage since debug logging is not enabled in our test * private empty constructor for utility classes - there's a rule that make sure a utility class (only with static methods) cannot be instantiated and we're cool with that but that really breaks down our coverage for the class, especially when the class has few methods. Any idea? Thanks, S. |
|
Hi Stephane
From what you're writing I think you want to exclude specific branches or code blocks in your source files (?)
I think this artcicle will actually help you :)
http://fahdshariff.blogspot.gr/2010/01/cobertura-ignore-logger-calls.html
Regards 2012/7/3 snicoll <[hidden email]> Hi, |
|
Hi,
I know how to configure that thing. My question is about how I can integrate that with Sonar. I don't have any specific cobertura plugin configuration in my Maven project right now, Sonar is taking care of everything. If configuring the plugin is an option, that's fine by me but I don't want cobertura to run in the regular build so there should be some way to enable it only when Sonar runs. Thanks, S. |
|
Hi Stephane
I suppose you are using maven. First you don't have to run cobertura analysis each time you build your project. You can
A) Adjust your maven build command to skip tests if you want to. Or B) you can create Maven profiles to handle both cases.
So this is the first step in your configuration that has nothing to do with Sonar. Now with Sonar analysis you have two options. A ) Make your analysis use the maven profile where you have configured Cobertura or
B ) Use
sonar.dynamicAnalysis and
sonar.cobertura.reportPath Sonar properties ( http://docs.codehaus.org/display/SONAR/Advanced+Parameters ) to use existing Cobertura reports instead of running Cobertura during Sonar analysis
Regards
2012/7/3 snicoll <[hidden email]> Hi, |
|
Hi,
On Tue, Jul 3, 2012 at 12:11 PM, Papapetrou P.Patroklos [via Sonar] <[hidden email]> wrote:
Yes.
How do I do that?
|
|
Hi Stephane
You can take a look at this :
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
Regards 2012/7/3 snicoll <[hidden email]> Hi, |
|
Hi,
We're going in circles here. I know how Maven works and I know how to create and invoke a profile. Sonar is launching the analysis through the Jenkins plugin. In your last response you said "
Make your analysis use the maven profile". How do I configure the Sonar plugin in Jenkins to trigger my profile? S.
On Wed, Jul 4, 2012 at 8:06 AM, Papapetrou P.Patroklos <[hidden email]> wrote: Hi Stephane |
|
Hi Stephane
You just have to add maven profiles properties ( i.e. -PmyProfie1 ) - or any other property you want - , in Jenkins Sonar plugin configuration.
Look at this : http://www.diigo.com/item/image/1j2dd/8n5k and of course don't forget this one : http://docs.codehaus.org/display/SONAR/Activate+Sonar+on+Jenkins+job
Hope that this time we closed our circle ;) Regards
Patroklos 2012/7/4 Stephane Nicoll <[hidden email]> Hi, |
|
Ah! Now I feel stupid not to have found that earlier. Will try that, thanks!
On Wed, Jul 4, 2012 at 9:06 AM, Papapetrou P.Patroklos <[hidden email]> wrote: Hi Stephane |
|
I've meen in similar position several times!! That's why user mailing lists exist :) Regards
Patroklos
2012/7/4 Stephane Nicoll <[hidden email]> Ah! Now I feel stupid not to have found that earlier. Will try that, thanks! |
| Powered by Nabble | Edit this page |
