This feature currently assigns a score of test hungriness to methods.

How test hungry sore is calculated?

Test hungry score calculates on 2 parameters such as Complexity and Network Size.

The score is calculated as Complexity * Network Size.
The complexity of a function means how many if/else are present in a method/function. This is basically a cyclomatic complexity.
Network Size is the number of functions directly or indirectly calling the TestHungry method/function.

e.g. if Foo is being called by XF & YF. The Network Size would be 2.
But if YF is being called by AF. Then Foo’s network size is 3.

Example

This is a sample code that states that methods inside this code are test hungry methods.

if ((networkSize > numCallingMethodsThreshold && Limit.gt(complexityHalfThreshold, CYC))
                    || (networkSize > numCallingMethodsHalfThreshold && Limit.gt(complexityThreshold, CYC))) {
   Its Test Hungry
     
}

Below are terms used in the above code:

  • networkSize: as explained above
  • numCallingMethodsThreshold: 6
  • numCallingMethodsHalfThreshold: 3
  • complexityThreshold: 5
  • complexityHalfThreshold: 2.5

Test Hungry Score cutoff

The test hungry score has a minimum and maximum values.

  • The minimum score limit is 15.
  • The maximum score is infinite.