In-Lab Exercise
CS494, Spring 2005, April 11

Exploring JUnit using Eclipse, JDepend, etc.

    Start Eclipse, and connect to CVS repository and checkout the project junitdemo.

    1. Open the CVS Repository view. How? One way: Window->ShowView->Other->CVS...
    2. Right click in this view, and select New -> Repository Location.
    3. Enter (or chose) grad12.cs.virginia.edu for the host.
    4. Enter /home/cs494/tbh3f/cvsdemos for the pathname.
    5. Enter your user-name and password, and choose extssh for the connection type.
    6. Open the new repository entry for this. You'll see the directory tree for junitdemo.
    7. Right click on this and choose Check Out. This will create a project on your local drive.

In lab today, do some or all of tasks 1 - 4 below, depending on your time and interest. Look at all of them later on your own.

  1. Use a machine that can run JDepend, and get a list of the packages, what classes are in them, and what packages each depends on. Draw a package dependency diagram. By each package write down the Abstractness and Instability metrics that JDepend reports. Note: all machines in 001 now run JDepend. You can download and install it on your own machine from here.

  2. Draw a class diagram for the framework package. You don't have to list the attributes and operations.

  3. In the package extensions, look for a decorator class. Try to understand what this is for and how it's used in JUnit. (What classes are decorators of this type? What do they try to do?)

  4. JUnit has an interactive user interface, so we want to show the results of the test as it happens
    incrementally. To achieve this, JUnit uses the Observer pattern.
    The TestRunner class implements an interface TestListener; it plays the role of Observer. The class TestResult plays the role of Subject or Observable.

    Examine these classes and understand what makes this an example of Observer.