3

Possible Duplicate:
How to run Junit testcases from command line?

How can I run JUnit from the command line in Linux?

Community
  • 1
  • 1
Ammu
  • 5,067
  • 9
  • 34
  • 34

1 Answers1

2

Here you will find a way to do that.

As stated on JUnit FAQ:

How do I run JUnit from my command window?

  1. Set your CLASSPATH

  2. Invoke the runner by "java org.junit.runner.JUnitCore (test class name)"

Harry Joy
  • 58,650
  • 30
  • 162
  • 207
  • 1
    I did this but getting some main class not found error for org.junit.runner.JUnitCore – Ammu Apr 19 '11 at 10:55
  • Are you sure your classpath is correct? – Harry Joy Apr 19 '11 at 10:57
  • yes....The path in which my junit-3.8.1.jar is /home/myname/myroot/.m2/repository/junit/junit/3.8.1/ and i have added it to my class path so that when i do echo $CLASSPATH i get /home/myname/myroot/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar – Ammu Apr 19 '11 at 11:05
  • 1
    @Ammu:- Make sure you are running .class file and not the .java file.\ – Harry Joy Apr 19 '11 at 11:37
  • JUnit 3.8.1 does not have `org.junit.runner.JUnitCore`. Upgrade to a more recent version of JUnit; 3.8.1 is very old. – NamshubWriter Feb 09 '13 at 23:25