Testing Assignment
Due: Monday, April 9, 2007
This assignment is intended to introduce you to the joys of testing and debugging. The goal is to evaluate
how valuable two testing strategies are. Keep track of how long you spend on steps #3 and #5. Each person in
the class should:
- Grab the Minesweeper code. Even if you still have it from the
debugging assignment, you must do this again -- a different set of bugs has been introduced.
-
Checkpoint the code in MineField.C: just make a copy, since we are not using source control for such
a small code base, and append "_v1.0" to the original to "tag" it.
- If your last name alphabetically begins with L or earlier, do the remaining steps, 3 to 7, in order.
Otherwise, do those steps in the order 5, 6, 3, 4, 7.
- Step through each line of code in gdb. Follow the guidelines from
Writing Solid Code, Chapter 4 on how to do
this. The idea is to check variable values and other state information before and after execution of each
line and verify that the line did what you expected. You will find bugs. Fix them. Continue the process.
Whatever lines you change or add you will need to step through again.
- When every line has been successfully stepped through, checkpoint the code again: this time, make a copy
of MineField.C (which you have now modified) and append "_v1.1" (or _v1.2 if your last name falls after L) to
your modified file to tag that version as well. This completes the first testing strategy.
- Do a code review with someone else in the class. Explain the structure of the code and what each line of
code is doing. Ask your reviewer to be really certain that they understand what the code is doing. Augment
your comments where they are confusing. Fix any bugs that you find.
- When every line has been successfully reviewed, checkpoint the code again and tag the file appropriately
(as detailed in step 4). This completes the second testing strategy.
- You will now have three versions of your code. Hand in:
- The final version, MineField.C_v1.2
- Pairwise diffs (see the diff man page if you are unfamiliar with diff) for versions 0 vs. 1 and 1 vs.
2 of your code
- The amount of time you spent on steps 3 and 5
- What order you did the steps in
- Who did the code review with you
- Your opinion of the value of the two testing strategies. Remember, your opinion can't be wrong, only
missing.
- How does this process fit into an overall testing plan? What else, generally, should you be doing
to test your program?
[an error occurred while processing this directive]