Equivalence Partitioning Example

Grocery Store Example

Consider a software module that is intended to accept the name of a grocery item and a list of the different sizes the item comes in, specified in ounces. The specifications state that the item name is to be alphabetic characters 2 to 15 characters in length. Each size may be a value in the range of 1 to 48, whole numbers only. The sizes are to be entered in ascending order (smaller sizes first). A maximum of five sizes may be entered for each item. The item name is to be entered first, followed by a comma, then followed by a list of sizes. A comma will be used to separate each size. Spaces (blanks) are to be ignored anywhere in the input.
 

Derived Equivalence Classes

  1. Item name is alphabetic (valid)
  2. Item name is not alphabetic (invalid)
  3. Item name is less than 2 characters in length (invalid)
  4. Item name is 2 to 15 characters in length (valid)
  5. Item name is greater than 15 characters in length (invalid)
  6. Size value is less than 1 (invalid)
  7. Size value is in the range 1 to 48 (valid)
  8. Size value is greater than 48 (invalid)
  9. Size value is a whole number (valid)
  10. Size value is a decimal (invalid)
  11. Size value is numeric (valid)
  12. Size value includes nonnumeric characters (invalid)
  13. Size values entered in ascending order (valid)
  14. Size values entered in nonascending order (invalid)
  15. No size values entered (invalid)
  16. One to five size values entered (valid)
  17. More than five sizes entered (invalid)
  18. Item name is first (valid)
  19. Item name is not first (invalid)
  20. A single comma separates each entry in list (valid)
  21. A comma does not separate two or more entries in the list (invalid)
  22. The entry contains no blanks (???)
  23. The entry contains blanks (????)
Black Box Test Cases for the Grocery Item Example based on the Equivalence Classes Above.
 
# Test Data Expected Outcome Classes Covered
1 xy,1 T 1,4,7,9,11,13,16,18,20,22
2 AbcDefghijklmno,1,2,3  ,4,48 T 1,4,7,9,11,13,16,18,20,23
3 a2x,1 F 2
4 A,1 F 3
5 abcdefghijklmnop F 5
6 Xy,0 F 6
7 XY,49 F 8
8 Xy,2.5 F 10
9 xy,2,1,3,4,5 F 14
10 Xy F 15
11 XY,1,2,3,4,5,6 F 17
12 1,Xy,2,3,4,5 F 19
13 XY2,3,4,5,6 F 21
14 AB,2#7 F 12

CPE 206 Home