jeudi 31 mai 2018

Path coverage testing: Basic logic

I am trying to understand Path coverage completely and I have a question:

Let's say I have this program:

for (int i = 0; i <array.length;i++) {

      if (...) //1
     {
       //do sth

       return false;
     }

     if(...) //2
     {
            if(...) //2A
            {
             //Do sth
            }
            else () //2B
            {
               if (...) //2BX
               {
                  //Do sth
               }
               else  //2BY
               {
                  //Do sth
               }
          }
     else //3
     {
        //Do sth
     }
}
return true;

Is showing that, given an array of inputs, each code (do sths) in 1,2A,2BX,2BY,3 is executed enough to satisfy path coverage testing?

A single input array[i] can only execute the code in only one of these (1,2A,2BX,2BY,3)

Or does the permutation of these //do somethings matter because there is a for loop in the program?

I am a little confused behind the logic behind it.

Thanks!

Aucun commentaire:

Enregistrer un commentaire