JGrasp and JUnit Integration
Requirements
- Java JDK 1.5 or later
- JGrasp
v1.8.6 or later
- If
you do not already have JGrasp installed, please download the latest
version from http://www.jgrasp.org/.
- This write-up was
created with JGrasp version 1.8.6; exact instructions may differ if the
version you are downloading is newer.
- JUnit v4.4
- If you do not already have
JUnit 4.4 installed, please download it from here.
Save it somewhere in your directories and remember this location.
Initial
JGrasp/JUnit Setup
Add JUnit to
Workspace
Classpath
- Load/open JGrasp.
- Under "Settings",
select "PATH / CLASSPATH" and then "Workspace".
- Under the "PATH" tab, select the "CLASSPATHS" tab.
- Click "New" to add a
new jar file to the classpath.
- 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.
- Click "OK" on the "Settings for workspace" window.
Running
JUnit Tests
- 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.
- 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.
- Or, from the
command-line, type
java
AllTests