CS 222 Spring 2016

Daily Tents, Part I

Due: March 10, Thursday, 11:00 am.

Language: Java (with JUnit)

Submission:

  • Check your file encoding. It should be UTF-8
  • Checkout the project DailyTents from SVN to get started
  • Commit your code to SVN

Assignment Explanation

Daily Tents Game is a puzle game similar to Sudoku. Please go and play with the game to get familiar with it. Your task for this week is to write test cases for Daily Tents game. So, in this assignment, you will not implement the method bodies of any of your classes; you will only write test cases. Test case classes should be put in a package named dailyTents.tests. Good testing requires you to test for the unexpected. Every function should have at least one test. However to get full credit, you should write tests which cover all corner cases and other possibilities that your program may eventually encounter.

  • For writing your test cases, please think of only the logic of the game not the GUI.
  • This means you will have a 2D board and some trees and tents on it.
  • You can assume that you will have a Tree and a Tent class in addition to Board class. Write test cases for these classes.
  • Think of how you would prepare this puzzle and also how would you solve this puzzle. This will guide you.

Task 1

Write JUnit test cases for the Daily Tents Game. Here are some trivial test cases to get you started.

  1. Check the dimensions of the board
  2. Check the coordinates of a board piece (Tent or Tree). You cannot place them outside your board. Expect to throw an exception here
  3. Check if a cell on the board is already occupied or not

Task 2

  1. Create a test suite for all of your tests.
  2. Make sure that all of your tests fail since there’s no implementation yet.
  3. Think of your test coverage. Do you think you covered all of the possible scenarios that can happen? Keep adding to your test cases.

Grading

  • Test Case Coverage (15)
  • Code Quality (15)
    • Names: 5
    • Functions: 5
    • Comments, JUnit annotations: 5