From: SourceForge.net <no...@so...> - 2010-07-08 17:44:58
|
Patches item #1576631, was opened at 2006-10-13 10:27 Message generated for change (Settings changed) made by lewijw You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=720017&aid=1576631&group_id=130558 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Accepted Priority: 5 Private: No Submitted By: Scott Frederick (scottyfred) >Assigned to: John Lewis (lewijw) Summary: Ignore trivial methods (optionally) Initial Comment: 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();") ---------------------------------------------------------------------- >Comment By: John Lewis (lewijw) Date: 2010-07-08 12:44 Message: This patch has been applied. Please see: https://sourceforge.net/tracker/index.php?func=detail&aid=3010530&group_id=130558&atid=720017 I believe that fabriziogiudici's desire for an annotation is also handled by the same patch. I will apply the rest of it soon. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2008-07-18 12:58 Message: Logged In: NO As first state, the criteria for excluding methods in this enhancement is much more strict than just looking for "get" or "set" in the name. Only methods that are truly trivial (only return the value of one data member or only set the value of one data member) are excluded. ---------------------------------------------------------------------- Comment By: Fabrizio Giudici (fabriziogiudici) Date: 2007-04-14 03:18 Message: Logged In: YES user_id=861031 Originator: NO Why instead don't you introduce an annotation (or a config file) to mark the methods to exclude one by one? Getter methods could be more complex than a simple "return foo": for instance in a proxy or in a decorator there is some logic inside. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=720017&aid=1576631&group_id=130558 |