Homework 3: Unit testing with JUnit and Eclemma


To Deliver: 

updated svn repository with maze and test code in a tag release 2.0, 

upload your test classes in a single archive file to the web-cat server

To Download: /home/scratch/kemper/project2.tar with existing Maze codebase

Due date for submission: September 27, at noon (12.00 PM)

Drop out date: October 1, at 5 AM (EARLY MORNING)


Motivation

We discussed test driven development and junit a tool for unit testing. The goal of this homework is to get more experience in developing a test suite that covers main stream intended usage as well as corner cases that a robust implementation should handle as well. 


In the first project assignment you worked on a stand alone problem that connected this class with the CS 241 class. For the rest of the class and further homework and project assignments, we will work on a single different problem which is about a Maze game.  

We will use an existing implementation by Paul Falstad (www.falstad.com) whose code is readily available over the internet. Note that the code is copyrighted. I contacted Paul Falstad and he gave us the permission to use and modify his code for teaching purposes in CS 301. While the original code is available and you may want to read it for your information, we will work on a refactored version that I produced (so blame errors on me). I reorganized the code into a few more classes and added comments which I believe will make it easier to understand. 


Important: Recognize and check if the code works. It should! The documentation came after the fact and need not be correct. If the documentation and code do not match, improve the documentation!


Run the MazeApplication and see how the Maze program works. 

To see how you can further operate the application, read the Maze.keyDown method to see what keyboard input the application reads and what it does with that.


Obviously, a rigid set of test cases will be useful to clarify particular functionality of individual classes as well as it will help you to familiarize yourself with the new codebase. 


Note that the intention for creating good test cases is a destructive one: the goal of a tester is to find errors and weaknesses in an implementation. A tester must imagine possible ways to break an implementation and think of input combinations that will lead to exceptions that the code cannot handle or will lead to wrong results. 


However, in the current situation, we have a (hopefully) running piece of code and we will develop test cases to characterize the existing behavior.

This is helpful for regression testing when you will add features to the existing code and may want to check that you did not break anything. 


This homework will set the state for future project assignments!


Requirements

For this homework, we need to develop a set of tests  for two classes: Cells.java and MazeBuilder.java.

This will result in two Junit test classes: CellsTest.java and MazeBuilderTest.java.

 The goal for both test classes is to achieve an overall coverage for Cells.java and MazeBuilder.java towards 100%.

 The grading will basically correspond to the coverage percentage you achieve.



To do list:


Further reading:

There is a brief junit cookbook for junit 4 right here.


Grading:


The grading is based on the release 2.0 of your code in your subversion repository.


You will receive points for: