Quantcast

Cobertura configuration

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Cobertura configuration

snicoll
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cobertura configuration

Patroklos Papapetrou
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,

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.

--
View this message in context: http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510.html
Sent from the Sonar user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cobertura configuration

snicoll
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cobertura configuration

Patroklos Papapetrou
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,

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.

--
View this message in context: http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000523.html
Sent from the Sonar user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cobertura configuration

snicoll
Hi,

On Tue, Jul 3, 2012 at 12:11 PM, Papapetrou P.Patroklos [via Sonar] <[hidden email]> wrote:
Hi Stephane
I suppose you are using maven.

Yes.
 
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 

How do I do that? 

 
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

2012/7/3 snicoll <[hidden email]>
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.

--
View this message in context: http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000523.html

Sent from the Sonar user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email






If you reply to this email, your message will be added to the discussion below:
http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000527.html
To unsubscribe from Cobertura configuration, click here.
NAML

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cobertura configuration

Patroklos Papapetrou
Hi Stephane 

2012/7/3 snicoll <[hidden email]>
Hi,

On Tue, Jul 3, 2012 at 12:11 PM, Papapetrou P.Patroklos [via Sonar] <
[hidden email]> wrote:

> Hi Stephane
> I suppose you are using maven.
>

Yes.


> 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
>

How do I do that?



> 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
> Patroklos
> Master Sonar with Sonar in Action book by Manning Publications<http://affiliate.manning.com/idevaffiliate.php?id=1233_299>
>
>
> 2012/7/3 snicoll <[hidden email]<http://user/SendEmail.jtp?type=node&node=5000527&i=0>
> >
>
>> 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.
>>
>> --
>> View this message in context:
>> http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000523.html
>>
>> Sent from the Sonar user mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000527.html
>  To unsubscribe from Cobertura configuration, click here< > .
> NAML<
http://sonar.15.n6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000563.html
Sent from the Sonar user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cobertura configuration

snicoll
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 

2012/7/3 snicoll <[hidden email]>
Hi,

On Tue, Jul 3, 2012 at 12:11 PM, Papapetrou P.Patroklos [via Sonar] <
[hidden email]> wrote:

> Hi Stephane
> I suppose you are using maven.
>

Yes.


> 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
>

How do I do that?



> 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
> Patroklos
> Master Sonar with Sonar in Action book by Manning Publications<http://affiliate.manning.com/idevaffiliate.php?id=1233_299>
>
>
> 2012/7/3 snicoll <[hidden email]<http://user/SendEmail.jtp?type=node&node=5000527&i=0>
> >
>

>> 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.
>>
>> --
>> View this message in context:
>> http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000523.html
>>
>> Sent from the Sonar user mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>
>
> ------------------------------

>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000527.html
--
View this message in context: http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000563.html

Sent from the Sonar user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cobertura configuration

Patroklos Papapetrou
Hi Stephane 
You just have to add maven profiles properties ( i.e. -PmyProfie1 )  - or any other property you want - , in Jenkins Sonar plugin configuration. 

Hope that this time we closed our circle ;)
Regards
Patroklos




2012/7/4 Stephane Nicoll <[hidden email]>
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 

2012/7/3 snicoll <[hidden email]>
Hi,

On Tue, Jul 3, 2012 at 12:11 PM, Papapetrou P.Patroklos [via Sonar] <
[hidden email]> wrote:

> Hi Stephane
> I suppose you are using maven.
>

Yes.


> 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
>

How do I do that?



> 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
> Patroklos
> Master Sonar with Sonar in Action book by Manning Publications<http://affiliate.manning.com/idevaffiliate.php?id=1233_299>
>
>
> 2012/7/3 snicoll <[hidden email]<http://user/SendEmail.jtp?type=node&node=5000527&i=0>
> >
>

>> 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.
>>
>> --
>> View this message in context:
>> http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000523.html
>>
>> Sent from the Sonar user mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>
>
> ------------------------------

>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000527.html
--
View this message in context: http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000563.html

Sent from the Sonar user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cobertura configuration

snicoll
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 
You just have to add maven profiles properties ( i.e. -PmyProfie1 )  - or any other property you want - , in Jenkins Sonar plugin configuration. 

Hope that this time we closed our circle ;)
Regards
Patroklos




2012/7/4 Stephane Nicoll <[hidden email]>
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 

2012/7/3 snicoll <[hidden email]>
Hi,

On Tue, Jul 3, 2012 at 12:11 PM, Papapetrou P.Patroklos [via Sonar] <
[hidden email]> wrote:

> Hi Stephane
> I suppose you are using maven.
>

Yes.


> 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
>

How do I do that?



> 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
> Patroklos
> Master Sonar with Sonar in Action book by Manning Publications<http://affiliate.manning.com/idevaffiliate.php?id=1233_299>
>
>
> 2012/7/3 snicoll <[hidden email]<http://user/SendEmail.jtp?type=node&node=5000527&i=0>
> >
>

>> 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.
>>
>> --
>> View this message in context:
>> http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000523.html
>>
>> Sent from the Sonar user mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>
>
> ------------------------------

>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000527.html
--
View this message in context: http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000563.html

Sent from the Sonar user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email






Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cobertura configuration

Patroklos Papapetrou
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!


On Wed, Jul 4, 2012 at 9:06 AM, Papapetrou P.Patroklos <[hidden email]> wrote:
Hi Stephane 
You just have to add maven profiles properties ( i.e. -PmyProfie1 )  - or any other property you want - , in Jenkins Sonar plugin configuration. 

Hope that this time we closed our circle ;)
Regards
Patroklos




2012/7/4 Stephane Nicoll <[hidden email]>
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 

2012/7/3 snicoll <[hidden email]>
Hi,

On Tue, Jul 3, 2012 at 12:11 PM, Papapetrou P.Patroklos [via Sonar] <
[hidden email]> wrote:

> Hi Stephane
> I suppose you are using maven.
>

Yes.


> 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
>

How do I do that?



> 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
> Patroklos
> Master Sonar with Sonar in Action book by Manning Publications<http://affiliate.manning.com/idevaffiliate.php?id=1233_299>
>
>
> 2012/7/3 snicoll <[hidden email]<http://user/SendEmail.jtp?type=node&node=5000527&i=0>
> >
>

>> 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.
>>
>> --
>> View this message in context:
>> http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000523.html
>>
>> Sent from the Sonar user mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>
>
> ------------------------------

>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000527.html
--
View this message in context: http://sonar.15.n6.nabble.com/Cobertura-configuration-tp5000510p5000563.html

Sent from the Sonar user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email







Loading...