Loops in Software Testing Methodologies

Loops

  • A single loop can be covered with cases: Looping and Not looping. But experience shows that many loop related bugs are not discovered by C1+C2
  • Bugs hide themselves in corners and gather at boundaries in the cases of loops, at or around the minimum or maximum number of times the loop can be iterated
  • The minimum number of iterations is often zero, but it need not be
  • There are three case for a single loop:
Case 1:
    Single loop, zero minimum, N maximum,  No Excluded values
Case 2:
    Single loop, non zero minimum, no excluded values
Case 3:
    Single loops with excluded values
Case 1:
  • Try bypassing the loop (zero iterations). If you cant, you either have a bug, or zero is not the minimum and you have the wrong case
  • Could the loop-control variable be negative? could it appear to specify a negative number of iteratins? What happens to such a value?
  • One pass through the loop
  • Two passes through the loop
  • A typical number of iterations, unless covered by a previous test
  • One less than the maximum number of iterations
  • The maximum number of iterations
  • Attempt one more than the maximum number of iterations. What prevents the loop control variable from having this value? What will happen with this value if it is force?
 Case 2:
  • Try one less than the expected minimum
  1.     What happens if the loop control variables value is less than the minimum?
  2.     What previous the value from being less than the minimum?
  • The minimum number of iterations
  • One more than the minimum number of iterations
  • Once, unless covered by a previous test
  • Twice, unless covered by a previous test
  • A typical value
  • One less than the maximum value
  • The maximum number of iterations
  • Attempt one more than the maximum number of iterations
Case 3:
  • Treat single loops with excluded values as two sets of tests, consisting of loops without excluded values, such as case 1 and case 2 above
    Example: The total range of the loop control variable is 1 and 20, but that values 7, 8, 9, 10 are excluded. The two sets of tests are 1-6 and 11-20
  • The test cases to attempt would be 0, 1, 2, 4, 6, 7 for the first range and 10, 11, 15, 19,20, 21 for the second range
Share on Google Plus

About Data Sciences by Venu

Hi, My name is Venugopala Chary and I'm Currently working as Associate Professor in Reputed Engineerng College, Hyderabad. I have B.Tech and M.tech in regular from JNTU Hyderabad. I have 11 Years of Teaching Experience for both B.Tech and M.Tech Courses.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment