CPSC 333: Lab Exercise #11: Testing a Simple Class

Location: [CPSC 333] [Lab Exercise] [Previous Exercise] [Next Exercise] Exercise #11


The following exercise will be taken up in labs on April 9-10 and April 14-15. If at all possible, you should try to solve these problems ahead of time, so that you can compare your own solutions to the ones presented during labs, or have questions ready to ask in case you had trouble solving them.

This is based on material presented in class on April 7, 1997.


Note: This exercise resembles Question #2 on Assignment #5, and should serve as practice for that part of the assignment.

The directory

~eberly/CPSC333/Lab11

contains the following files.

As an aid for testing and debugging, a ``show'' function has been (temporarily) included in the interface for a counter; this displays the counter's current value along with all the ``history'' information that should determine how it responds to future operations.

The file counter_with_history.h should be used as the reference for how the ``counter'' class is supposed to behave.

As usual (for this course, in April), the code is intentionally buggy: One error has been seeded into counter_with_history.cpp, and you will notice this after careful testing of the programs that have been provided for you.

In this exercise, you are to use the code and program provided in order to try to identify the part of the ``counter'' class that is incorrect (that is, inconsistent with the information in the header file). Since the source code counter_with_history.cpp hasn't been provided, you will need to try to use ``black box testing'' in order to do this.

Information provided in recent lectures should be useful for this exercise. Additional information can be found in

B. Marick
The Craft of Software Testing: Subsystem Testing (Including Object-Based and Object-Oriented Testing)
Prentice-Hall, 1995

This has been placed on reserve for use in this course.

During the labs on April 9 and 10, this exercise will be discussed - but not taken up. You can use this time to discuss ideas for ``black box tests'' that might be applied in order to look for errors in this program.

During the labs on April 14 and 15, the ``solution'' for the exercise will be given. That is, the source code counter_with_history.cpp will be made available, and the error will be displayed.

Location: [CPSC333] [Lab Exercises] [Previous Exercise] [Next Exercise] [Exercise #11]


Department of Computer Science
University of Calgary

Office: (403) 220-5073
Fax: (403) 284-4707

eberly@cpsc.ucalgary.ca