我有框架创建的测试类
import org.selenium.MainTestCase;
public class Test01 extends MainTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
startSeleniumSession("RemoteWebDriver", "http://102.0.0.01:8080/hello/");
}
public void testMethod() throws Exception {
session().open("/hello/request.co","");
session().selectFrame("top_frame");
session().type("id=lgn:username","test");
session().type("id=lgn:password","test");
session().click("id=lgn:submit");
session().waitForFrameToLoad("top_frame","");
}
@Override
public void tearDown() throws Exception {
super.tearDown();
}
}
我有bat文件
javac -cp .\lib\* Test01.java
java -cp .\lib\* org.junit.runner.JUnitCore Test01
在 lib 文件夹中,我拥有为我生成 Test01
类的所有 jar 和框架。
当我运行bat文件时,我得到了结果:
JUnit 版本 4.10 找不到类:Test01 时间:0,002 好的(0 次测试)
类和库的结构是:
根文件夹 - dist
lib
文件夹(位于 dist
下) - 我所有的库都放置在其中
在dist
文件夹中,我有Test01.class
和Test01.java
和run.bat
最佳答案
您需要使用 .
将当前目录添加到类路径中。在基于 Windows 的系统上,您可以使用 ;
分隔文件夹,而在基于 UNIX 的系统上,您可以使用 :
分隔文件夹。
Windows 示例:my/path/1;.
(添加路径 my/path/1
和当前目录)
Unix 示例:my/path/1:.
(添加路径 my/path/1
和当前目录)
关于java - 找不到类 JUNIT org.junit.runner.JUnitCore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32183471/