JUnit run tests command line

后端 未结 2 2066
礼貌的吻别
礼貌的吻别 2021-02-10 02:09

I\'ve got the following structure

lib/junit-4.10.jar
tests/Tester.java
tests/Tester.class
build/jar/jar_file.jar

(Tester belongs to package tes

相关标签:
2条回答
  • 2021-02-10 02:36

    The classpath should be semi colon separated (on Windows - not sure what you are using.)

    java -cp build/jar/jar_file.jar;lib/junit-4.10.jar org.junit.runner.JUnitCore tests.Tester
    

    Also with this command line you will need to run it in your project root

    0 讨论(0)
  • 2021-02-10 02:38

    Assuming this is Linux/Mac (not Windows) and your path separator is correct (:), since your test class files exist in package subdirectories under the current working directory (.) You need to add "." to your class path, for example:

    java -cp .:build/jar/jar_file.jar:lib/junit-4.10.jar org.junit.runner.JUnitCore tests.Tester
    
    0 讨论(0)
提交回复
热议问题