如何从终端运行JUnit测试

时间:2017-11-19 07:37:57

标签: java unit-testing junit terminal

我有一个包含以下子文件夹和文件的文件夹

proj
    src
        Class.java
    test
        Test.java

文件Test.java发出import org.junit.*命令,并使用Class.java中的类。

我编译了Class.java。我现在正在尝试编译Test.java。在proj/test文件夹中,我尝试了以下几种变体:

javac -cp ../src org.junit Test.java

我收到了一些错误,都与它找不到org.junitClass.java有关。例如

error: package org.junit does not exist

并参考Class.java中的一个类:

error: cannot find symbol

我发现的问题最近的是about running a test from the command line, but this seems to have already successfully compiledthis one but it has a .jar file, which I don't have and I suspect I shouldn't be making one just now。另外,因为我没有使用.jar个文件,this question does not apply to my problem

0 个答案:

没有答案