Asst: Unit Testing
This assignment will give you practice in writing unit tests in the
*Unit style. For this assignent you will be working with some
very old code that I developed for my CS330 Object-Orietned
Programming class. The code implements a spreadsheet and illustrates
OO design principles, multi-threaded GUIs, and the MVC pattern of UI
design.
You may either choose to work in Java or C++. Both versions of the
spreadsheet separate the core spreadsheet functionality (the
mode) from the UI (view and control). The C++ version of the
spreadsheet actually has two separate user interfaces. One is pure
C++, using the Unix curses library to do a pure text-only
interface. The other demonstrates the design of a Java/C++ hybrid,
using a Java program to provide a GUI that interfaces with the
C++ spreadsheet code.
-
From the ~zeil/courses/cs795SD/assts directory, get
either javaSpreadsheet.zip or
cppSpreadsheet.zip. Unpack into a
convenient working directory. Create an Eclipse project using that
directory. Demonstrate for yourself that you can build and run the
spreadsheet.
-
You may find some naming conflicts among the Java files.
These are most likely caused the presence, in the Model
directory, of both actual implementations of some ADTs and
of stubs that i created for testing purposes.
The model directory includes some old test
drivers that I had produced. You might look at these for
suggestions, but keep in mind that these test drivers predate
the availability of *Unit packages and are, in many cases,
not self-checking.
-
The C++ version includes makefiles. You can use these as
a guide for how to set up your Eclipse project settings.
You may get some error messages about duplicate main
functions. These will stem from the presence of some test
drivers that I had produced. You might look at these for
suggestions, but keep in mind that these test drivers predate
the availability of *Unit packages and are, in many cases,
not self-checking.
-
Create a unit test for one (or more, if you are feeling ambitious)
of the following components of the spreadsheet model:
-
The Expression class hierarchy, including printing and
evaluating expressions
-
The Expression parser.
-
The Spreadsheet class
If you are working with C++, you may use either the Google or
Boost test frameworks. If you are working with Java, use JUnit 4.
For the best score on this assignment, use mock classes to isolate
the class under test from the larger subsystems within the model
(to my mind, the major subsystems are the Value class hierarchy,
the Expression class hierarchy, the parser, and the
Spreadsheet/Cell structures).
-
Submit your unit tests using the button below.