CpSc372

Introduction to Software Engineering

Assignment 5

Unit Testing

 

 

 

 

 

NOTICE: The Puck class in the zipfile is incorrect. The correct one is here. Only annotate this class using OCL and write test cases. Do not attempt to run the test cases.

Goal: Gain experience in selecting, implementing, and analyzing tests.

 

Description: Testing beginning with the smallest possible units results in higher quality of the completed product. Developing and executing these tests is a time sink for developers.  Semi-automated test tools assist the developer. The JUnit tool provides the means for rapid development and execution of tests.

 

 

Procedure:

  1. Download the junit distribution. Install JUnit.
  2. Download the classes under test and the sample test file. Unzip
  3. Annotate the classes (except for LostDialog) using OCL.
  4. Select tests to be executed.
  5. Write and compile these tests.
  6. Execute the tests using JUnit.

java junit.swingui.TestRunner SimpleTest (or other test class name)

  1. Observe the results and analyze the results.
  2. Add tests based on the previous results.
  3. Write-up the results.
  4.  (1 pt Extra credit) Also test the LostDialog class.

 

Turn-in: The code that has been annotated with OCL constraints, the test classes you write or expand. Each test should have a comment in its code that explains why this particular test was selected for execution. Also include an analysis of suspected problems with the code.

 

Date change At the request of several students I am extending the dealine for this project to 4pm Friday October 24th. I hope you find this time useful.

Due: 4 pm Wednesday October 22th via email

 

Points 3 points

 

Team: 2 person team assignment

 

Evaluation: Comprehensiveness of test coverage, clarity of justification for test selection.