Programming and Problem Solving with Java

(やまだぃちぅ) #1

(^538) | Array-Based Lists
But what about testinglength,resetList, andgetNextItem? They do not appear explicitly
in the test plan, but they are tested each time we call the auxiliary methodprintListto
print the contents of the list. We do, however, have to add one test involving the iterator: We
must print outlengthitems to test whether the current position is reset after the last item
is returned.
To implement this test plan, we must construct a test driver that carries out the tasks
outlined in the first column of the preceding plan. We might make the test plan be a doc-
ument separate from the driver, with the last column filled in and initialed by a person run-
ning the application and observing the screen output. Alternatively, we might incorporate
the test plan into the driver as comments and have the output go to a file. The key to
properly testing any software lies in the plan: It must be carefully thought out and it must
be written.
Here is the output from a test driver that implements this test plan:

Free download pdf