1

I want to execute test class in selenium_101.jar from command line in Ubuntu (test doesn't have any Selenium dependencies). I always get error "Main class org.junit.runner.JUnitCore not found".

I installed JUnit4 with

sudo apt-get install junit

and copied all files from /usr/share/java to a test folder, org.hamcrest.core comes from Eclipse plugin folder:

bbo@dev-obi:/test/selenium/java$ ls -al
-rw-r--r-- 1 obiz obiz  34328 Mär  1 13:47 hamcrest-core-1.1.jar
-rw-r--r-- 1 obiz obiz  45024 Mär  1 15:36 hamcrest-core-1.3.jar
lrwxrwxrwx 1 obiz obiz     21 Mär  1 15:36 hamcrest-core.jar -> hamcrest-core-1.3.jar
-rw-r--r-- 1 obiz obiz 217909 Mär  1 13:47 hamcrest-generator-1.1.jar
lrwxrwxrwx 1 obiz obiz     26 Mär  1 13:47 hamcrest-generator.jar -> hamcrest-generator-1.1.jar
-rw-r--r-- 1 obiz obiz   7722 Mär  1 13:47 hamcrest-integration-1.1.jar
lrwxrwxrwx 1 obiz obiz     28 Mär  1 13:47 hamcrest-integration.jar -> hamcrest-integration-1.1.jar
-rw-r--r-- 1 obiz obiz  47766 Mär  1 13:47 hamcrest-library-1.1.jar
lrwxrwxrwx 1 obiz obiz     24 Mär  1 13:47 hamcrest-library.jar -> hamcrest-library-1.1.jar
-rw-r--r-- 1 obiz obiz  31752 Mär  1 13:47 java-atk-wrapper.jar
-rw-r--r-- 1 obiz obiz 108762 Mär  1 13:47 junit-3.8.2.jar
-rw-r--r-- 1 obiz obiz 222584 Mär  1 13:47 junit4-4.8.2.jar
lrwxrwxrwx 1 obiz obiz     16 Mär  1 15:11 junit4.jar -> junit4-4.8.2.jar
lrwxrwxrwx 1 obiz obiz     16 Mär  1 15:12 junit.jar -> junit4-4.8.2.jar
-rw-r--r-- 1 obiz obiz  55198 Apr 18  2016 org.hamcrest.core_1.3.0.v201303031735.jar
lrwxrwxrwx 1 obiz obiz     41 Mär  1 15:07 org.hamcrest.core.jar -> org.hamcrest.core_1.3.0.v201303031735.jar
-rw-r--r-- 1 obiz obiz   1326 Feb 28 14:40 selenium_101.jar

I read:

How to run JUnit test cases from the command line

Could not find class JUNIT org.junit.runner.JUnitCore

and tried:

java -cp ./*.jar org.junit.runner.JUnitCore selenium_101
java -cp /test/selenium/java/*.jar org.junit.runner.JUnitCore selenium_101
java -cp /usr/share/java/*.jar junit.runner.JUnitCore selenium_101

Always same problem with org.junit.runner.JUnitCore.

Community
  • 1
  • 1
Fabian_Z071
  • 275
  • 1
  • 11

0 Answers0