JGrasp and JUnit Integration

Requirements

 

Initial JGrasp/JUnit Setup

Add JUnit to Workspace Classpath

  1. Load/open JGrasp.
  2. Under "Settings", select "PATH / CLASSPATH" and then "Workspace".
  3. Under the "PATH" tab, select the "CLASSPATHS" tab.
  4. Click "New" to add a new jar file to the classpath.
  5. Browse to find your junit-4.4.jar file from your JUnit 4.4 installation. You can leave the documentation path blank. Click "OK" to proceed.
  6. Click "OK" on the "Settings for workspace" window.

 

Running JUnit Tests

  1. Load your java file that contains your test suite. The file should contain a main method with a single line executing your suite with the TestRunner. For example:

 

public static void main (String[] args) {
      junit.textui.TestRunner.run (suite());
}

 

where suite() refers to your suite’s collection of tests. For an example, see AllTests.java.

  1. Run the application as you would normally. For example, in JGrasp, select the AllTests.java file and click on the button with a red man running.
  1. Or, from the command-line, type

java AllTests