PageRenderTime 19ms CodeModel.GetById 14ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 0ms

/ant-task/documentation/ant.html

http://testability-explorer.googlecode.com/
HTML | 140 lines | 126 code | 14 blank | 0 comment | 0 complexity | 3a82a1738b1c50257c4a289182dec127 MD5 | raw file
  1<html>
  2
  3<head>
  4<meta http-equiv="Content-Language" content="en-us">
  5<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  6<title>Testability Task</title>
  7</head>
  8
  9<body>
 10
 11<h2><a name="testability">Testability</a></h2>
 12<h3>Description</h3>
 13<p>Runs the Testability-Explorer from Ant.</p>
 14
 15<h3>Parameters</h3>
 16<table border="1" cellpadding="2" cellspacing="0">
 17  <tr>
 18    <td valign="top"><b>Attribute</b></td>
 19    <td valign="top"><b>Description</b></td>
 20    <td align="center" valign="top"><b>Required</b></td>
 21  </tr>
 22
 23  <tr>
 24    <td valign="top">resultfile</td>
 25    <td valign="top">File to write results into</td>
 26    <td valign="top" align="center">No, defaults to System.out.</td>
 27  </tr>
 28  <tr>
 29    <td valign="top">errorfile</td>
 30    <td valign="top">File to write errors into.</td>
 31    <td valign="top" align="center">No; defaults to restultfile value.</td>
 32  </tr>
 33  <tr>
 34    <td valign="top">failureproperty</td>
 35    <td valign="top">Set this property to true if build should fail based on findings, but don't stop the ant process immideately.</td>
 36    <td valign="top" align="center">No</td>
 37  </tr>
 38  <tr>
 39    <td valign="top">print</td>
 40    <td valign="top">Prints the result in different formats and level of detail.
 41        <ul>
 42           <li>summary -- print package summary inforamtion</li>
 43           <li>detail -- print detail drill down information for each method call</li>
 44           <li>html -- print html summary information</li>
 45        </ul>
 46    </td>
 47    <td valign="top" align="center">No; defaults to summary.</td>
 48  </tr>
 49  <tr>
 50    <td valign="top">printDepth</td>
 51    <td valign="top">Maximum depth to recurse and print costs of classes/methods that the classes under analysis depend on.</td>
 52    <td valign="top" align="center">No; defaults to 0.</td>
 53  </tr>
 54  <tr>
 55    <td valign="top">mincost</td>
 56    <td valign="top">Minimum Total Class cost required to print that class' metrics.</td>
 57    <td valign="top" align="center">No; defaults to 1.</td>
 58  </tr>
 59  <tr>
 60    <td valign="top">maxexcellentcost</td>
 61    <td valign="top">Maximum Total Class cost to classify it as 'excellent'.</td>
 62    <td valign="top" align="center">No; defaults 50.</td>
 63  </tr>
 64  <tr>
 65    <td valign="top">maxacceptablecost</td>
 66    <td valign="top">Maximum Total Class cost to classify it as 'acceptable'.</td>
 67    <td valign="top" align="center">No; defaults to 100.</td>
 68  </tr>
 69  <tr>
 70    <td valign="top">worstoffendercount</td>
 71    <td valign="top">Print <i>n</i> number of worst offending classes.</td>
 72    <td valign="top" align="center">No; defaults to 20.</td>
 73  </tr>
 74  <tr>
 75    <td valign="top">whitelist</td>
 76    <td valign="top">Colon delimited whitelisted packages that will not count against you. Matches packages/classes starting with given values. (Always whitelists java.*).</td>
 77    <td valign="top" align="center">No.</td>
 78  </tr>
 79  <tr>
 80    <td valign="top">cyclomatic</td>
 81    <td valign="top">Cyclomatic cost multiplier. When computing the overall cost of the method the individual costs are added using the weighted average. This represents the weight of the cyclomatic cost.</td>
 82    <td valign="top" align="center">No; defaults to 1</td>
 83  </tr>
 84  <tr>
 85    <td valign="top">global</td>
 86    <td valign="top">Global state multiplier. When computing the overal cost of the method the individual costs are added using weighted average. This represents the weight of the global state cost.</td>
 87    <td valign="top" align="center">No; defaults to restultfile value.</td>
 88  </tr>
 89
 90</table>
 91
 92<h3>Parameters specified as nested elements</h3>
 93
 94<h4>fileset</h4>
 95<p>
 96<a href="http://jakarta.apache.org/ant/manual/CoreTypes/filterset.html">FileSets</a>
 97are used to get the list of jar files and/or class directories.
 98</p>
 99
100<h3>Examples</h3>
101
102<p><b>Integrate Testability-Explorer into Ant environment</b></p>
103<pre>
104&lt;taskdef name="testability" classname="com.google.ant.TestabilityTask"  classpath="<i>PATH_TO_TE</i>/ant-task-1.3.1.jar;<i>PATH_TO_TE</i>/core-1.3.1-with-deps.jar"/&gt;
105</pre>
106
107<p><b>Use Testability-Explorer with default settings</b></p>
108<pre>
109&lt;target name="testability-simple"&gt;
110   &lt;testability&gt;
111      &lt;fileset dir="lib"&gt;
112         &lt;include name="project.jar"/&gt;
113      &lt;/fileset&gt;
114   &lt;/testability&gt;
115&lt;/target&gt;
116</pre>
117
118<p><b>Use Testability-Explorer customized </b></p>
119This example shows all possible arguments of the ant task including the <i>failproperty</i>. Instead of breaking the build on the spot this property is set and the build continues. The second snippet shows how the property can be read and used to break the build at a well defined timing.
120<pre>
121&lt;target name="testability-complex"&gt;
122   &lt;testability filter="" resultfile="testability.result.html" errorfile="testability.err.txt"
123                printdepth="2" print="html" mincost="1" maxexcellentcost="50"
124                maxacceptablecost="100" worstoffendercount="25" whitelist="com.thirdparty."
125                cyclomatic="1" global="10" failproperty="testability.failproperty"&gt;
126      &lt;fileset dir="lib"&gt;
127         &lt;include name="*.jar"/&gt;
128      &lt;/fileset&gt;
129      &lt;fileset dir="build/classes"&gt;
130         &lt;include name="com/ownstuff/**"/&gt;
131      &lt;/fileset&gt;
132   &lt;/testability&gt;
133&lt;/target&gt;
134
135&lt;target name="testability-break-build.test" depends="testability-complex"&gt;
136   &lt;fail if="testability.failproperty" message="testability failed"/&gt;
137&lt;/target&gt;
138</pre>
139
140</body></html>