Homework: Design a Test Plan


This homework is necessary preparation for the lab. Your job is to design a test plan to test the following static method that converts a given NaturalNumber into a String with commas in a format similar to the one used by the method printWithCommas you implemented in a previous lab: In the lab you will be given several defective implementations of the method (only the executable version, not the source code) and your goal is to expose all the defects with your test plan.

  1. Design the test plan as discussed in Testing (in particular, slides 40-46). For each test case, provide the input(s), expected result(s), and a short explanation of the rationale for the test case.
  2. Convert each test case into a JUnit test method as discussed in JUnit (in particular, see slides 20-23 for the recommended style).
  3. Make sure your JUnit test cases are typed in a file you bring to the lab so that you will be able to quickly copy and paste them into a JUnit test fixture.

For this homework, you can just turn in a printout of the file you prepare for the lab as long as a brief rationale for each test case is included in a Javadoc comment right before each test case.