CASE STUDY^509
Depending on the number of questions, there could be thousands of cases in the third
category. How many do we have to try to convince ourselves that the application is cor-
rect? The end cases here would be that they agree in the first and last positions, they
do not agree in the first and last position, they agree somewhere in the middle, and
they disagree somewhere in the middle.
As the algorithm is not dependent on the number of questions, let’s use 5 questions
for our test cases.
Provided our input is correct, if the implemented test plan produces the expected
results, we should be fairly confident that the application is correct.Provided our input is
correct?We have not built any error checking into these classes. This omission is a seri-
ous flaw in our design. The Case Study Follow-Up questions at the end of this chapter
ask you to make these classes more robust by adding error checking. The results of this
test plan are shown here.
Test # Reason for Test Input Expected Output
1
2
3
4
Initial input
All correct
(Also tests same in
first and last
position)
All wrong
(also tests different in
first and last
position)
Partially correct
Test ending condition
5
Answer Key
TTTTT
Jones
TTTTT
Janet Jerome
FFFFF
Jeff Jubilee
TFTFT
eof on data
file
file
Joe Jones:
number correct 5
Janet Jerome:
number correct 0
Jeff Jubilee:
number correct 3
application ends