Skip to main content

Test conditions and coverage items

    Step 2. Derivation of test conditions.  The test conditions are executable instructions. Note that our code one line of the program corresponds to a single instruction. All test conditions are for ET1.

  • TC1: instruction number 2; 
  • TC2: instruction number 3;
  • TC3: instruction number 4;
  • TC4: instruction number 5; 
  • TC5: instruction number 6; 
  • TC6: instruction number 7; 
  • TC7: instruction number 8;
  • TC8: instruction number 9;

   Step 3. Derivation of coverage elements. Coverage elements directly create test conditions:

  • CE1: instruction number 2;
  • CE2: instruction number 3;
  • CE3: instruction number 4;
  • CE4: instruction number 5;
  • CE5: instruction number 6;
  • CE6: instruction number 9;
  • CE7: instruction number 10;
  • CE8: instruction number 11;

    The requirement to pass through all coverage elements is equivalent to the requirement to cover all GFC rows from image 9.1. Note that there is a single control path passing through all rows: 

B1 → B2 B3 → B5 → B6 → B4  → B3 → B7 → B8

    This means that only one test case implementing this path is enough to meet 100% instruction coverage. You need to find such input values for it(T array) that the for loop, the body of the if statement and the do-while loop execute at least once.