[ 
http://jira.codehaus.org/browse/MCOBERTURA-52?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=140357#action_140357
 ] 

Fabian Reichlin commented on MCOBERTURA-52:
-------------------------------------------

I think the <ignore> statement is rather confusing -- instead of ignoring 
entire methods in custom classes, just single method calls within custom 
methods are filtered out (e.g. logging statements in your methods). So, if 
entire methods from your classes should be excluded (e.g. when they cannot be 
tested) in favor of getting a higher code coverage rate, it just would not be 
possible.

We patched Cobertura and the Maven-Cobertura-Plugin such that entire methods 
can now be excluded from instrumentation. If you're interested, add 
[ftp://el4.elca-services.ch/htdocs/el4j/maven2repository/] to your mirrors, and 
use it as follows:

{code:xml}
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cobertura-maven-plugin</artifactId>
    <version>2.2-el4j_20080702_1630</version>
    <configuration>
        <instrumentation>
            <!-- Ignore entire methods from being instrumented. -->
            <ignoreMethods>
                <!-- Ignore all methods ending with Untested from
                the com.yourcompany package. -->
                <ignoreMethod>com.yourcompany.*.*Untested</ignoreMethod>
            </ignoreMethods>
        </instrumentation>
    </configuration>
</plugin>
{code}

Note that it is also possible to e.g. ignoring setter and getter method, by 
configuring
{code:xml}
<ignoreMethods>
    <!-- Ignore all setter and getter methods. Note the dot
    in front of the method names! -->
    <ignoreMethod>.set*</ignoreMethod>
    <ignoreMethod>.get*</ignoreMethod>
</ignoreMethods>
{code}


> Ignores and Excludes do nothing
> -------------------------------
>
>                 Key: MCOBERTURA-52
>                 URL: http://jira.codehaus.org/browse/MCOBERTURA-52
>             Project: Maven 2.x Cobertura Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: Windows
>            Reporter: Jim Wilson
>
> After adding this to the POM:
>   <build>
>     <plugins>
>       <plugin>
>         <groupId>org.codehaus.mojo</groupId>
>         <artifactId>cobertura-maven-plugin</artifactId>
>         <configuration>
>           <instrumentation>
>             <excludes>
>               <exclude>org/example/**/*Test.class</exclude>
>               <exclude>${basedir}</exclude>
>             </excludes>
>           </instrumentation>
>           <check>
>             <haltOnFailure>false</haltOnFailure>
>           </check>
>         </configuration>
>         <executions>
>           <execution>
>             <goals>
>               <goal>clean</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>
> Cobertura still reports on all classes.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

    http://xircles.codehaus.org/manage_email


Reply via email to