day7
asked on
JUnit installation
I've been searching all over trying to understand why I can't get JUnit to work to no avail. Here's what I've done, exactly as the instructions say:
>>>>How do I install JUnit?
>>>>First, download the latest version of JUnit, referred to below as junit.zip.
>>>>Then install JUnit on your platform of choice:
>>>>Windows
>>>>To install JUnit on Windows, follow these steps:
>>>>Unzip the junit.zip distribution file to a directory referred to as >>>>%JUNIT_HOME%.
>>>>Add JUnit to the classpath:
>>>>set CLASSPATH=%CLASSPATH%;%JUN IT_HOME%\j unit.jar
Unfortunately, the next step, testing the installation, fails
>>>>Test the installation by using either the textual or graphical test runner to run >>>>the sample tests distributed with JUnit.
>>>>Note: The sample tests are not contained in the junit.jar, but in the installation >>>>directory directly. Therefore, make sure that the JUnit installation directory is in >>>>the CLASSPATH.
>>>>For the textual TestRunner, type:
>>>>java junit.textui.TestRunner junit.samples.AllTests
>>>>For the graphical TestRunner, type:
>>>>java junit.swingui.TestRunner junit.samples.AllTests
>>>>All the tests should pass with an "OK" (textual) or a green bar (graphical).
>>>>If the tests don't pass, verify that junit.jar is in the CLASSPATH.
The following appears from the command line:
>Class not found "junit\samples\AllTests"
I've tried altering the path lto AllTests like so:
junit3.8.1\junit\samples\A llTests
%JUNIT_HOME%\junit3.8.1\ju nit\sample s\AllTests
according to the paths leading to the c: directory with the same results.
Command line 'set' reveals that junit.jar is in the classpath.
What am I doing wrong?
I'm just beginning in this, so if you explain something, especially about environmental variables and classpaths, etc. please explain fully.
thanks
>>>>How do I install JUnit?
>>>>First, download the latest version of JUnit, referred to below as junit.zip.
>>>>Then install JUnit on your platform of choice:
>>>>Windows
>>>>To install JUnit on Windows, follow these steps:
>>>>Unzip the junit.zip distribution file to a directory referred to as >>>>%JUNIT_HOME%.
>>>>Add JUnit to the classpath:
>>>>set CLASSPATH=%CLASSPATH%;%JUN
Unfortunately, the next step, testing the installation, fails
>>>>Test the installation by using either the textual or graphical test runner to run >>>>the sample tests distributed with JUnit.
>>>>Note: The sample tests are not contained in the junit.jar, but in the installation >>>>directory directly. Therefore, make sure that the JUnit installation directory is in >>>>the CLASSPATH.
>>>>For the textual TestRunner, type:
>>>>java junit.textui.TestRunner junit.samples.AllTests
>>>>For the graphical TestRunner, type:
>>>>java junit.swingui.TestRunner junit.samples.AllTests
>>>>All the tests should pass with an "OK" (textual) or a green bar (graphical).
>>>>If the tests don't pass, verify that junit.jar is in the CLASSPATH.
The following appears from the command line:
>Class not found "junit\samples\AllTests"
I've tried altering the path lto AllTests like so:
junit3.8.1\junit\samples\A
%JUNIT_HOME%\junit3.8.1\ju
according to the paths leading to the c: directory with the same results.
Command line 'set' reveals that junit.jar is in the classpath.
What am I doing wrong?
I'm just beginning in this, so if you explain something, especially about environmental variables and classpaths, etc. please explain fully.
thanks
you can add to your classpath %JUNIT_HOME%\src to be able to run the samples (as long as you the compiled under src)
ASKER
thanks aozarov but I still get the same results...also there is a AllTests.class file in the original path I gave "C:\%JUNIT_HOME%\junit3.8. 1\junit\sa mples\"
ASKER
ok, let me try it
ASKER
aozarov,
I added the following (below) to the classpath per the instructions above, which I didn't understand
>>>>Note: The sample tests are not contained in the junit.jar, but in the installation >>>>directory directly. Therefore, make sure that the JUnit installation directory is in >>>>the CLASSPATH.
C:\>set CLASSPATH=%CLASSPATH%;C:\J unit3\juni t3.8.1
that is, my installation directory, and it worked...Originally I had put just C;\JUnit3 and that's what stumped me, but the junit directory is one level up...
I added the following (below) to the classpath per the instructions above, which I didn't understand
>>>>Note: The sample tests are not contained in the junit.jar, but in the installation >>>>directory directly. Therefore, make sure that the JUnit installation directory is in >>>>the CLASSPATH.
C:\>set CLASSPATH=%CLASSPATH%;C:\J
that is, my installation directory, and it worked...Originally I had put just C;\JUnit3 and that's what stumped me, but the junit directory is one level up...
ASKER
I'm just new at this and didn't catch on too quick....
points to aozarov for the clue, but please see my comment above for the resolution
points to aozarov for the clue, but please see my comment above for the resolution
ASKER
aozarov,
If you could just leave one more post with the correct directory and I'll give you the points (just so the accepted answer is clear)...it's not '%JUNIT_HOME%\src', but '%JUNIT_HOME%\junit3.8.1' (at least for this version of JUnit). 'src' is a .jar file that contains all the .java files. The installation directory and its subdirectories have the .class files, at least for this version 3.8.1.
thanks
If you could just leave one more post with the correct directory and I'll give you the points (just so the accepted answer is clear)...it's not '%JUNIT_HOME%\src', but '%JUNIT_HOME%\junit3.8.1' (at least for this version of JUnit). 'src' is a .jar file that contains all the .java files. The installation directory and its subdirectories have the .class files, at least for this version 3.8.1.
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
the samples can be found src & classes under junit3.8.1\src\junit\sampl