Criteria-Based Test Design

Names:

/** * 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.

- What information goes into an input domain model?
What tests result?

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

- 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?

- 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?