Basis Path Testing

What is Basis Path Testing?

Basis path testing, a structured testing or white box testing technique used for designing test cases intended to examine all possible paths of execution at least once. Creating and executing tests for all possible paths results in 100% statement coverage and 100% branch coverage.

Example:

Function fn_delete_element (int value, int array_size, int array[])
{
 1 int i;
 location = array_size + 1; 

 2 for i = 1 to array_size
 3 if ( array[i] == value )
 4 location = i;
  end if;
  end for;

 5 for i = location to array_size
 6 array[i] = array[i+1];
 end for;
 7 array_size --;
} 

Steps to Calculate the independent paths

Step 1 : Determine the independent paths.
Path 1:  1 - 2 - 5 - 7 
Path 2:  1 - 2 - 5 - 6 - 7 
Path 3:  1 - 2 - 3 - 2 - 5 - 6 - 7
Path 4:  1 - 2 - 3 - 4 - 2 - 5 - 6 - 7
Share on Google Plus

About Riki Patel

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment