Using JUnit
under VisualAge for Java 2.0
This page describes how to use JUnit with VisualAge for Java:
Installing JUnit in VisualAge
for Java
To install JUnit into VisualAge for Java follow these steps:
-
import the resources from the INSTALLDIR\junit.jar file into your JUnit
project.
-
import the sources for the framework from src.zip into the JUnit project.
-
import the sample code and tests cases from INSTALLDIR\junit
Notice: The junit.swingui package requires Swing 1.1. If you don't
have this version loaded into your workspaces errors will show up. You
can delete this package when you don't have Swing 1.1 loaded or you can
tweak the import statements so that they refer to Swing 1.0.3 (not recommended).
Using JUnit
Here are some hints for how to use JUnit under VisualAge for Java.
-
When using the graphical TestRunner use the junit.ui.TestRunner. Don't
use junit.ui.LoadingTestRunner since VAJ takes care of updating the environment
so that you always run the latest version of your code.
-
Add the project including the test cases to be run to the TestRunner's
project path:
-
select the TestRunner
-
Selected->Properties
-
go to the Class Path page
-
add the project to the project path
Installing JUnit
as a VisualAge for Java tool
VisualAge for Java provides an open tools API to add custom tools
to the development environment. Here are the steps for how to install JUnit
as a Visual Age for Java Tool:
-
copy the directory vaj\tools\test-ui into the VAJ_INSTALLDIR\tools
directory
-
add JUnit to your workspace class path
-
open the options window: Window->Options...
-
select the Resources section and edit the workspace class path
-
click Edit... and enter JUnit
-
restart VisualAge for Java
Once JUnit is installed as a tool you can select a class and run its tests
with the Selected->Tools->JUnit or from the Quick Start menu item.
Notice: the projects of the test cases have to be on the workspace
class path to run them. Otherwise JUnit will not find the classes. For
example, to add your MyTests project to the workspace class path follow
the steps above and append your project, e.g., JUnit3;MyTests.