< Back

Unit Tests

Each requirement has been divied up between members of the development team. However, this means that different modules have multiple people responsible for them. From your requirements document, you should have a decent idea of what modules you need as well. For this assignment, you will all be writing test cases for your program independently.

You are required to write test cases for the modules listed in your design document. For each module, provide a set of unit tests, each in their own file. Your files should be named <module_name>_tests.java.

Ideally, these files should be directly executable to test your program once it has been written. As such, each of these files should have a main method that creates instances of module being tested, and feeds in the necessary data for each of the test cases.

For example, one possible test case for the Fraction.java class shown previously could be:

  //Test the case of a negative fraction as the first operand of
  //addition with a positive second operand.
  Fraction test_fraction_1 = new Fraction(-1, 2);
  Fraction test_fraction_2 = new Fraction(3, 4);

  Fraction result = test_fraction_1 + test_fraction_2;

  System.out.println(result + " == 1/4"); // Expect 1/4 == 1/4

You will be graded on the coverage (Both Test and Code) for your components. Make sure that your unit tests fully cover the code, as well as a sufficient amount of the possible test cases for your modules.

Be sure to provide a descriptions of:

Submission

Submit all of your tests cases and descriptions as one tar file to the College's inquire site by Monday, April 1st by 10:00 pm.