Tester Notes

tester.jar can be found under /home/cs102/jarfiles
Your BlueJ config file has already been set up to find it.

Examples class

Create an Examples class for your project to test your program. For example:

import tester.*;
 
public class Examples
{
    // fields are examples of Student objects
    private Student s1 = new Student("Marc", "999-00-0001");
 
    // constructor has nothing to do
    public Examples() 
    {
        // fields initialized where they are defined
    }
 
    // class method that runs all the tests
    public static void run() 
    {
        Tester.runFullReport(new Examples());
    }
 
    // test methods use the tester library 
    public void test1(Tester t) 
    {
        t.checkExpect(s1.getName(), "Marc");
    }
}

Run the tests

To run your tests, either:

  • right-click on the Examples class and select the run() method, or
  • from Code Pad, enter the following statement:
    Examples.runFullReport(new Examples());


Output will appear in the BlueJ terminal window:

  • fields of class Example will appear as example data
  • aggregate test results will be reported
  • individual tests will be reported, including expected and actual values
courses/cs102-201201/testernotes.txt · Last modified: 2012/01/25 01:06 by mlsmith
VCCS Top Events Extended Site Search Login Vassar Science Web Vassar Home Driven by DokuWiki Valid XHTML 1.0