Back 3 months ago I asked a similar question: Error when running JUnit Tests from DOS Command line
I haven't solved the problem yet so I simplified the process by trying to run a simple sample TestCase Class from my Windows DOS command line.
My TestCase Class is:
package Test;
import org.junit.Test;
import org.junit.After;
import org.junit.Before;
public class TestCaseA
{
@Before
public void beforeMethod()
{
System.out.println("Before method..");
}
@Test
public void JUnit4Test()
{
System.out.println("In test method");
}
@After
public void afterMethod()
{
System.out.println("after method");
}
}
I have a folder E:\Jenkins\Test\ where my compiled .class file exists and jUnit jar insdie E:\Jenkins\Test\lib\
See attached screen shots:
The command I am running to execute this from command line on a Windows Server MS DOS prompt is:
1. I Change Directory into E:\Jenkins\Test
2. E:\Jenkins\Test>java -cp E:\Jenkins\Test\junit-4.10.jar;Test\TestCaseA.class; org.junit.runner.JUnitCore Test.TestCaseA
The output:
JUnit version 4.10
Could not find class: Test.TestCaseA
Time: 0
OK (0 tests)
What am I missing? Please help.