I am trying to run JUnit tests via the command line, and I'm running into issues. Here is the code:
package tests;
import org.junit.Test;
public class InitialTwo {
@Test
public void test() throws Exception
{
System.out.print("Testing");
}
}
I tried following the instructions here and here but nothing seems to work. I've added the junit.jar and hamcrest.jar files to a java folder in my home directory, and also added these lines to the bash_profile:
export JUNIT_HOME="$HOME/java"
export PATH="$PATH:$JUNIT_HOME"
export CLASSPATH="$CLASSPATH:$JUNIT_HOME/junit-4.12.jar:$JUNIT_HOME/hamcrest-core-1.3.jar"
I then ran this with this result:
java -cp .:/Users/home/java/junit-4.12.jar .:/Users/home/java/hamcrest-core-1.3.jar org.junit.runner.JUnitCore InitialTwo
Error: Could not find or load main class .:.Users.home.java.hamcrest-core-1.3.jar
or this
java org.junit.runner.JUnitCore InitialTwo
Error: Could not find or load main class org.junit.runner.JUnitCore
I honestly have no idea what I'm doing wrong. The code runs and populates results when ran in Eclipse, but not on the command line.
Thanks for the help!