SWE 437 In Class Exercise # 12
Criteria-Based Test Design


Names:

Instructions: Work with your neighbors in groups. Consider the leap year function:
/** 
   * Determines if the argument is a leap year in the Gregorian calendar
   * Assumes that arguments are in Gregorian calendar range (1582 and onwards)
   * 
   * @param year value in range for Gregorian calendar
   * @return true iff year is a leap year
   */
public static boolean isLeap(int year) {
     
     if (year % 4 != 0) return false;

     if (year % 400 == 0) return true;  

     if (year % 100 == 0) return false;

     return true;
   }
Build models for the software, and find tests that "cover" the models. You may find it easier to think about the tests first.
  1. What information goes into an input domain model? What tests result?


  2. What does a graph model for this function look like? What tests result?


  3. What does a logic model for this function look like? What aspect of the program makes this model weak? Is there a refactored program where the logic model is stronger? What tests result?


  4. What does a syntax model for this function look like? What tests result? As it turns out, the syntax model addresses the weakness of the logic model. How?