Menu

#74 Many in one: Ignoring methods; risky classes/methods; .

open
nobody
None
9
2014-08-28
2008-11-27
Ho Tri Bao
No

Many in one: Ignoring certain methods from coverage calculation; listing risky classes/methods; instrument on the fly; bug fix for zero-complexity bug

This is my patch for my requested features at: https://sourceforge.net/tracker/index.php?func=detail&aid=2353057&group_id=130558&atid=720018

I attach here both SVN diff (patch) and the jar file with Maven POM. I name this version is

- Cobertura: 1.9-SNAPSHOT-2 (meaning the patch based on version 1.9)
- cobertura-maven-plugin: 2.2-SNAPSHOT-2
- cobertura-runtime: 1.9-SNAPHSHOT-2

Why it's SNAPHSHOT-2? I made SNAPHSHOT-1 just for ignored methods (not released). And now, SNAPHSHOT-2 include everything :-)

There are screenshot so that you can preview what's new.

1. Bug fix for zero-complexity bug
In addition to the bug fix, I change the average complexity to accumulated complexity

2. Ignoring certain methods from coverage calculation
New configuration
+ Commanline
--ignoreMethod class_name#method_name#method_descriptor
+ Maven
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.2-SNAPHSHOT-2</version>
<configuration>
<instrumentation>
<ignoreMethods>
<ignoreMethod>com.*.LocaleServiceImpl#getCountryService</ignoreMethod>
<ignoreMethod>com.*.LocaleServiceImpl#getLanguageService</ignoreMethod>
</ignoreMethods>
</instrumentation>
</configuration>
</plugin>

Syntax: class_name#method_name#method_descriptor
Class name: fully qualified class. Ex: x.y.z.DummyServiceImpl
Method name: name (only name) of the method. For example: doSomething
Method descriptor: method arguments types and return type. Using bytecode representation syntax (see http://www-128.ibm.com/developerworks/java/library/j-cwt02076.html\) For example: if a method receives a String and returns an x.y.z.DummyObject, the expression is: (Ljava/lang/String;)Lx/y/z/DummyObject;

Method descriptor is only useful in case you have overloading methods. Otherwise, it can be omitted
Wildcards (not regular expression. For it's easier for all people to use wildcard instead of regular expression) can be used in both 3 parts. The following wildcards are supported:
* Any zero or more characters
? A single character

3. Listing risky classes/methods

==================================
4. On-the-fly instrumentation
Not yet complete :-( I will post it latter (it will be in a separate JAR, no modification on Cobertura is needed)

Discussion

  • Ho Tri Bao

    Ho Tri Bao - 2008-11-27
    • priority: 5 --> 9
     
  • Ho Tri Bao

    Ho Tri Bao - 2008-11-27

    File Added: cobertura-patch.zip

     
  • Ho Tri Bao

    Ho Tri Bao - 2008-11-27

    SVN diff (source codes)

     
  • Ho Tri Bao

    Ho Tri Bao - 2008-11-27

    File Added: dashboard.PNG

     
  • Ho Tri Bao

    Ho Tri Bao - 2008-11-27

    Screenshot: what is shown in the dashboard now

     
  • Ho Tri Bao

    Ho Tri Bao - 2008-11-27

    Screenshot: how ignored methods are shown

     
  • Ho Tri Bao

    Ho Tri Bao - 2008-11-27

    File Added: ignored-methods.PNG

     
  • Ho Tri Bao

    Ho Tri Bao - 2008-11-27

    Cobertura JAR with Maven POM

     
  • Ho Tri Bao

    Ho Tri Bao - 2008-11-27

    File Added: cobertura-maven.zip

     
  • Ho Tri Bao

    Ho Tri Bao - 2008-11-27

    File Added: cobertura-maven-plugin.zip

     
  • Ho Tri Bao

    Ho Tri Bao - 2008-11-27

    corresponding cobertura-maven-plugin

     
  • Ho Tri Bao

    Ho Tri Bao - 2008-11-27

    Corresponding cobertura-runtime

     
  • Ho Tri Bao

    Ho Tri Bao - 2008-11-27

    File Added: cobertura-runtime.zip

     
  • John Lewis

    John Lewis - 2008-12-23

    Thanks for the patch! It looks like great work. I have applied the Complexity fix first. Revision 552.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.