Implements the JBlanket Apache Ant task definition that instruments the byte code. All files
(.class or .jar files) specified by the fileSet element in the Ant task are processed by the
Modifier class and stored in the directory specified by the jblanket.dir system property.
If not set, the default directory is <user_home>/<user_account>/jblanket/.
Required nested element for the instrumentation task:
Use multiple 'fileset' elements to specify different locations of files to modify.
Optional nested element for the instrumentation task:
'packageprefix' - describes the package prefixes to be modified in a JAR file. To instrument
all classes in a JAR file, do not included this nested element.
For example: see PackagePrefix
'sysproperty' - describes additional system properties not set in the environment. If
jblanket.dir is not set as an environment variable, include this nested element
to set it.
For example: see Ant
Required attribute for the instrumentation task:
'testgrammar' - grammar describing the names of JUnit test classes
For example: testgrammar="Test*.class"
Optional attributes for the instrumentation task:
'enable' - describes if the byte code should be modified. Valid values include "true", "on",
"yes" to modify byte code or "false", "off", or "no" to not modify byte code.
For example: enable="true"
'verbose' - describes if additional output should be sent to standard out.
Valid values include "true", "on", "yes" for additional output
or "false", "off", or "no" for no additional output.
For example: verbose="false"
'excludeonelinemethods' - describes if methods with one line of code should be excluded from
the coverage measurement. Values include "true", "on", "yes" to
exclude one-line methods or "false", "off", or "no" to include them.
For example: excludeonelinemethods="false"
'excludeconstructors' - describes if constructors should be excluded from the coverage
measurement. Values include "true", "on", "yes" to exclude constructors
or "false", "off", or "no" to include them.
For example: excludeconstructors="false"
'totalfile' - name of XML file to contain all methods included in the coverage measurement
For example: totalfile="totalMethods.xml"
'untestablefile' - name of XML file to contain all abstract or native methods
For example: untestablefile="untestableMethods.xml"
'excludedfile' - name of XML file to contain all methods excluded from the coverage measurement
by either the fileset or packageprefix nested element
For example: excludedfile="excludedMethods.xml"
'onelinefile' - name of XML file to contain all one-line methods
For example: onelinefile="oneLineMethods.xml"
'constructionfile' - name of XML file to contain all constructors
For example: constructorfile="constructorMethods.xml"
If any of the optional attributes are not specified, their default values specified in the
examples are used. For example, to exclude methods with one line of source code from the
coverage measurement, specify the 'excludeonelinemethods' attribute with a 'true' value.
When not specified, one-line methods will be included in the coverage measurement.
Use this class to execute JBlanket with Ant. One example of the 'jblanket' Ant target is:
<taskdef name="jblanket" classname="csdl.jblanket.ant.JBlanketModifierTask"/>
<jblanket testgrammar="Test*.class"
excludeonelinemethods="true"
totalfile="myTotalMethods.xml"
untestablefile="myUntestableMethods.xml">
<fileset dir="${basedir}">
<include name="**/stackmvc/**/*.class"/>
</fileset>
<fileset dir="${lib.dir}">
<include name="stack.jar"/>
</fileset>
</jblanket>
From the example, one-line methods are excluded and constructors are included. The total
methods will be stored in 'myTotalMethods.xml' and untestable methods are stored in
'myUntestableMethods.xml'. The default file names for excluded methods and one-line methods are
used. No additional output will be sent to standard out. The files to be modified are the
.class files found in the subdirectories beginning with 'stackmvc' and the 'stack.jar' file in
${lib.dir}.
Another example is:
<jblanket testgrammar="*Test.class"
verbose="true">
<fileset dir="${src.dir}">
<include name="**/foo/*.class"/>
</fileset>
</jblanket>
where the total methods, untestable methods, and excluded methods are stored in the default
files. One-line methods and constructors are included in coverage. Additional output will be
sent to standard out. The files to be modified are the .class files found in the
subdirectories beginning with 'foo'.
NOTE: For JBlanket to collect data, all files MUST be compiled with debug turned "on".
author: Joy M. Agustin version: $Id: JBlanketModifierTask.java,v 1.2 2005/02/19 05:55:19 timshadel Exp $id |