繁体   English   中英

JUnit中的“找不到类”

[英]“Could not find class” in JUnit

我正在使用AIX机器运行一些JUnit测试。 使用Windows和Linux平台上的JUnit,这些测试在eclipse中运行良好。 我正在尝试使用JUnit命令行运行这些测试,但出现以下错误

# java org.junit.runner.JUnitCore testName
JUnit version 4.8.1
Could not find class: testName

Time: 0.012

OK (0 tests)

文件在该位置显示为testName.java。 我已经在/ etc / profile文件中设置了环境变量。 这些是我的环境变量。

导出CLASSPATH = / usr / junit / junit-4.8.1.jar:/ usr / junit /

导出PATH = $ PATH = $ PATH:/usr/junit/junit-4.8.1.jar:/ usr / junit /

在AIX机器上,当我尝试使用以下代码测试JUnit时,它也给我带来同样的失败。

# java org.junit.runner.JUnitCore org.junit.tests.AllTests
JUnit version 4.8.1
Could not find class: org.junit.tests.AllTests

Time: 0.012

OK (0 tests)

JUnit网站http://junit.sourceforge.net/doc/faq/faq.htm#tests_1提供的默认位置中没有AllTests类。

# find / -name "*AllTests*"
/usr/junit/org/junit/runners/AllTests.class

有什么事吗

org.junit.tests.AllTests

在错误的地方,在这里

/usr/junit/org/junit/runners/AllTests.class

它应该是

/usr/junit/org/junit/tests/AllTests.class

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM