junit.jar
). You can either do this each time you use
the compiler/interpreter or you can set an operating system
environment variable named CLASSPATH
.
CLASSPATH
as follows:
where directory denotes the name of the directory/folder
that contains the file junit.jar
.
For example, assuming that junit.jar
is in the current
working directory, you can set the CLASSPATH
as follows:
After you have set the CLASSPATH
you can compile your
classes (including the test classes) and the usual way, and run a JUnit test
as follows:
where ClassName is the name of the class being tested. For example,
to run AtomTest
:
CLASSPATH
you must tell Java
where to find JUnit every time you compile and/or run a test.
To compile:
where Name represents tha name of the class being tested (and can contain wildcards like *).
To run:
where Name represents the name of the class being tested.
For example, to compile and run AtomTest
:
assertEquals()
.
Copyright 2019