Method Coverage
Runtime Analysis
// while define 3 logical blocks
return result;
}
public static int resourcesAvailable()
{
return (_free_resources_++);
}
public static int _free_resources_=0;
public static void main( String[] argv )
{
//first call: '0 loop' block is reach
_free_resources_=1;
tryFiveTimes();
//second call: '1 loop' blocks are reach
_free_resources_=0;
tryFiveTimes();
//third call: '2 loops or more' blocks are reach
_free_resources_=-10;
tryFiveTimes();
}
}
Method Coverage
Inputs to Procedures
Inputs identify the Java methods executed.
Example
public class Inputs
{
public static int method()
{
return 5;
}
public static void main( String[] argv )
{
System.out.println("Value:"+method());
}
}
One branch per Java method is defined.
Procedure Inputs, Outputs and Returns, and Terminal Instructions
These include the standard output (if coverable), all return instructions, and calls to
exit(), abort(), or terminate(), as well as the input.
Example
public class InputsOutputsAndReturn
{
public static void method0( int _selector )
{
if ( _selector < 0 )
{
return ;
}
53