This patch implements a new feature in Cobertura that
allows trivial methods (getters, setters, etc.) to be
excluded from coverage metrics. This feature is useful
if you follow the philosophy that trivial getters and
setters "can't break" and therefore do not need unit tests.
The Ant task and command-line Main accept a new option
named "ignoreTrivial". If this option is set to
"true", methods that match the criteria below are
excluded from coverage. If the option is set to
"false", then all methods are included as Cobertura
does today.
The criteria for deciding a method is trivial are:
getters:
- method name begins with "get", "is", or "has"
- method accepts no arguments
- method return type is non-void
- method contains only bytecode instructions for
getting member field values
setters:
- method name begins with "set"
- method accepts exactly one argument
- method return type is void
- method contains only bytecode instructions for
setting member field values
initializers:
- method name is "<init>" (constructors and implicit
initializers)
- method contains only bytecode instructions for
setting member field values and calling initializer
method of immediate superclass (e.g. "super();")
Nobody/Anonymous
None
None
Public
|
Date: 2008-07-18 17:58 Logged In: NO |
|
Date: 2007-04-14 08:18
|
| Filename | Description | Download |
|---|---|---|
| patch.txt | Download |
| Field | Old Value | Date | By |
|---|---|---|---|
| File Added | 198046: patch.txt | 2006-10-13 15:27 | scottyfred |