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