PageRenderTime 35ms CodeModel.GetById 32ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/eclipse-plugin/plugins/com.google.test.metric.eclipse.doc/doc/TestabilityExplorer.html

http://testability-explorer.googlecode.com/
HTML | 42 lines | 37 code | 5 blank | 0 comment | 0 complexity | 2a7323cc496fc8227147bc27ee9b0422 MD5 | raw file
 1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 2<html>
 3   <head>
 4      <title>What is the Testability Explorer</title>
 5   </head>
 6
 7   <body>
 8      <h2>
 9         What is the Testability Explorer
10      </h2>
11      <p>
12         Testability-explorer is a tool which analyzes Java bytecode and computes how difficult it will be to write unit tests for the code. It attempts to help you quantitatively determine how hard your code is to test, and where to focus to make it more testable.
13      </p>
14      
15      <p>
16      Testability Explorer can be used:<br/>
17
18      <ol>
19        <li> As a learning tool which flags causes of hard to test code with detailed breakdown of reasons. </li>
20        <li> To identify hard to test hair-balls in legacy code. </li>
21        <li> As part of your code analysis-toolset. </li>
22        <li> As a tool which can be added into continuous integration that can enforce testable code. </li> 
23      </ol>
24      </p>
25
26      <p>
27      Currently the tool computes:<br/>
28
29      <ol>
30        <li> Non-Mockable Total Recursive Cyclomatic Complexity. Cyclomatic Complexity is a measure of how many different paths of execution are there in the code. It is computed, by counting the if, while, and case as branching primitives. It is recursive because cost of the method as well as any methods it calls are counted. It is total because cost of object construction as well as any static initializations are counted. And finally, it is non-mockable because any code which can be mocked out in test is not counted as part of the cost. This means that the score is based on the amount of complex code that cannot be mocked out in a unit test. </li>
31        <li> Global Mutable State. Counts the number of fields which are globally reachable by the class under test and which are mutable. Mutable global state makes testing difficult as tests are not isolatable, the global state needs to be set up and cleared between tests. </li>
32        <li> Law of Demeter. This is the principle that calling methods on objects you get from other collaborators is trouble, instead, the collaborator should call that method itself. It makes testing harder because your mocks must expose some internal state through these methods. </li>
33      </ol> 
34      </p>
35      <p>
36      For more information about testability explorer, please visit <a href="http://code.google.com/p/testability-explorer">http://code.google.com/p/testability-explorer</a>
37      </p>
38      <p>
39      For a demo of testability-explorer in action see <a href="http://testabilityexplorer.org/report">http://testabilityexplorer.org/report</a>.
40      </p>
41   </body>
42</html>