Sponsored Link •
junit.jarto the Runpath
When you type the following command, Artima SuiteRunner aborts because it can't load class
java -jar suiterunner-[release].jar accountjunit.srj
To enable Artima SuiteRunner to load
junit.framework.TestCase and the rest of the JUnit
classes, you must tell Artima SuiteRunner where to find
JUnit is not included in the Artima SuiteRunner distribution ZIP file.
Presumably, if you want to use Artima SuiteRunner as a JUnit runner, you have already JUnit installed on your
system. If you don't, you can download JUnit from junit.org.
Once you locate
junit.jar on your system, you can add it to Artima SuiteRunner's runpath by
editing the recipe. To edit the recipe, select File-->Edit Recipe, as shown in Figure 2.
Figure 2. Editing the recipe.
The Edit Recipe dialog allows you to edit all three components of the recipe: suites, runpath, and reporters. To add
to the runpath, you must select the Runpath tab, as shown in Figure 3.
Figure 3. Selecting the Runpath tab.
The easiest way to add
junit.jar to the runpath is by pressing on the Select button on the right hand side of the Runpath tab's dialog.
Pressing Select brings up a file chooser dialog with the title "Select JAR File or Directory to Add."
Use this dialog box to navigate to your copy of
junit.jar, as shown in Figure 4, then press Choose.
Figure 4. Selecting
junit.jar to add to the runpath.
On my Macintosh,
junit.jar is located in the
As Figure 5 shows,
junit.jar is now in the runpath. When you press OK, Artima SuiteRunner will change the runpath
per your request, and attempt to run
Figure 5. File
junit.jar is now in the runpath.
When you press the OK button of the Edit Recipe dialog, the
AccountTestCase should run and give the results shown in Figure 6.
Don't be disheartened by all the red you see in the Reports list. The example is supposed to fail initially. It is left as an exercise for you to
fix the bugs in the account example to get the test to run successfully. The existence of the Run Starting, Test Failed, and Run Completed
reports in the Reports list indicates that Artima SuiteRunner successfully loaded the JUnit classes and executed the example JUnit test suite.
Figure 6. With
junit.jar in the runpath, the
AccountTestCase example runs.