CS2102 (B10): Object-Oriented Design Concepts
Instructions for Using the Testing Library
Staff and Office Hours |
Lectures and Assignments |
We expect you to use a testing library that provides the
check-expect behavior you saw in Racket. In lecture, we showed how to
use check-expect in Java, but additional
documentation may be useful for future reference. Instructions
for using the testing library in each environment follow:
- Download the tester library.
- Download Main.java to the same
- When an assignment asks you to create a new project:
New files will go into this project folder unless you change projects.
- Make a new folder to hold all the project files.
- Copy Main.java into the new folder.
- Under the "Project" menu, select "New". After you name the
project, DrJava will bring up the "Project Properties" box.
- If it isn't set, select the new folder you just created as Project Root.
- Enter/select the "Main.java" file next to Main class.
- Select "Add" in Extra Classpath, then select the
tester.jar file you downloaded.
Experienced Eclipse Users
- Download the tester library.
tester.Tester into your
- In your Run Configurations, set tester.Main as your Main class
Step 1: set up your workspace and launch an Eclipse project
- Whereever you choose to keep your Java files, create two new folders
EclipseWorkspace and EclipseJars.
the tester library and save it to your EclipseJars
- Start Eclipse. If Eclipse prompts you for a workspace,
browse to the EclipseWorkspace folder you created.
If Eclipse doesn't prompt you for a workspace, then in the File menu, choose
Switch workspace and browse to your EclipseWorkspace folder.
- Create a project: in the File menu select New then
Java Project. Where it asks for Project Name type Project1 (you may select a different name, but we will refer to it as Project1 from now on).
Make sure that "Use an execution environment JRE" and "Create separate folders for sources and class files"
are selected, then select Next.
- In the Java Settings pane select the Libraries tab.
On the right click on Add External JARs...
You will get a chooser window. Navigate to your EclipseJars folder and select the tester jar file you downloaded.
Step 2: Creating files
- In Eclipse, it is customary to keep each class definition and
each interface in its own separate file. The convention is to name
the file Classname.java, where Classname is the name of
the class or interface that you're defining. In the File menu,
choose New and then select either Class or
Interface. Once you fill in the filename and click
Finish, a pane will open with your class/interface name.
Step 3: Set up the run configuration and run the program
- Highlight Project1 in the Package Explorer pane.
In the Run menu select Run Configurations....
In the top left corner of the inner pane click on the leftmost item. When you mouse over it should show "New launch configuration". (If this item isn't available,
choose Java Application. The New launch configuration item should now be
Select the name for this configuration - usually the same as the name of your project.
Where it says Main class: click on Search.... and choose
Main - tester. Click Apply and then Run to run your
If you did everything correctly, you should see a message in the
Console window that says something about "Tests for the class:
Examples". The next time you want to run the same project, hit the
green circle with the white triangle on the top left side of the main