Static metrics reference

This section provides a reference list of static metrics displayed in the Create New Component Test wizard for Java and EJB component tests. These metrics can help you measure the impact of your test and can help you define a test strategy.

 

Architecture metrics

The following metrics provide indications about the architecture of components found in the scope of the test project.

Name Formula Description

Fan In

Fan in formula

Number of public methods + public attributes of the class or EJB

FanOut

Fan out formula

Number of distinct utilizations of methods or attributes defined outside the class or EJB

ExtUse

External use formula

Number of distinct classes or EJBs that use public attributes or methods of the measured class or EJB.

 

Component complexity metrics

The following metrics measure the testability of the source code.

Name Formula Description

Methods

Weighted methods per class formula

Methods (or weighted number of methods per class) is a count of the methods in a class or EJB.

WAC

Weighted attributes per class

Attributes (or weighted number of attributes per class) is the number of attributes of a class or EJB.

Max V(g)

Maximum complexity where:

Maximum complexity formula

  • E: number of edges

  • N: number of nodes

The V(g) or cyclomatic number is an indicator of the complexity of a method. This is correlated with the difficulty of testing. Typically, V(g) varies between 1 and 10 where a value of 1 means the code has no branching. A method's cyclomatic complexity should not exceed 10. Max V(g) is the highest V(g) value encountered among all methods of the class or EJB.

Statements

Source lines of code

This metric simply represents the total number of source lines of code (SLOC), excluding comments.

Max nested levels

Maximum nested levels

The nested level indicates the number of levels contained in the structure. The Max nested level is the highest value encountered among all methods of the class or EJB. This is correlated with the complexity of the structure and, therefore, the difficulty of testing.

 

Coverage metrics

Test coverage allows you to identify components that have not already been sufficiently tested.

Name Description

NbTests

Number of times that the method has been called from a test suite.

Line (%)

Line coverage rate (in percent) of the class within all runs.

 

Related concepts

Static metrics