Example to Boundary Value Analysis:
MTEST is a program that grades
multiple-choice examinations. The input is a data file named
OCR, with multiple records that are 80 characters long. Per
the file specification, the first record is a title used as a
title on each output report. The next set of records describes
the correct answers on the exam. These records contain a "2"
as the last character. In the first record of this set, the
number of questions is listed in columns 1-3 (a value of
1-999). Columns 10-59 contain the correct answers for
questions 1-50 (any character is valid as an answer).
Subsequent records contain, in columns 10-59, the correct
answers for questions 51-100, 100-150, and so on.
The third set of records describes the
answers of each student; each of these records contains a "3"
in column 80. For each student, the first record contains the
student's name or number in columns 1-9 (any characters);
columns 10-59 contain the student's answers for questions
1-50. If the test has more than 50 questions, subsequent
records for the student contain answers 51-100, 101-150, and
so on, in columns 10-59. The maximum number of students is
200. The input data are illustrated in Figure 4. The four
output records are
- A report, sorted by student identifier, showing each
student's grade (percentage of answers correct) and rank.
- A similar report, but sorted by grade.
- A report indicating the mean, median, and standard
deviation of the grades.
- A report, ordered by question number, showing the
percentage of students answering each question correctly.
We can begin by methodically reading the
specification, looking for input conditions. The first
boundary input condition is an empty input file. The second
input condition is the title record; boundary conditions are a
missing title record and the shortest and longest possible
titles. The next input conditions are the presence of
correctanswer records and the number-of-questions field on the
first answer record. The equivalence class for the number of
questions is not 1-999, since something special happens at
each multiple of 50 (i.e., multiple records are needed). A
reasonable partitioning of this into equivalence classes is
1-50 and 51-999. Hence, we need test cases where the
number-of-questions field is set to 0, 1, 50, 51, and 999.
This covers most of the boundary conditions
for the number of correct-answer records; however, three more
interesting situations are the absence of answer records and
having one too many and one too few answer records (for
example, the number of questions is 60, but there are three
answer records in one case and one answer record in the other
case). |