找不到类JUNIT org.junit.runner.JUnitCore [英] Could not find class JUNIT org.junit.runner.JUnitCore

查看:752
本文介绍了找不到类JUNIT org.junit.runner.JUnitCore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有由框架创建的测试类

I have test class created by framework

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();
  }

}

我有蝙蝠文件

javac -cp .\lib\* Test01.java
java -cp .\lib\* org.junit.runner.JUnitCore Test01

在lib文件夹中,我拥有所有为我生成Test01类的jar和框架.

In lib folder I have all jars and framework which generated Test01 class for me.

运行bat文件时,我得到了结果:

When I run my bat file I got result:

JUnit版本4.10 找不到Coul类:Test01 时间:0,002 确定(0个测试)

JUnit version 4.10 Coul not find class: Test01 Time: 0,002 OK(0 tests)

类和库的结构是:

根文件夹-dist

lib文件夹(在dist下)-我所有的库都放在其中

lib folder(under dist) - where all my libs placed

dist文件夹中,我有Test01.classTest01.javarun.bat

In dist folder I have Test01.class and Test01.java and run.bat

推荐答案

您需要使用.将当前目录添加到类路径.在基于Windows的系统上,用;分隔文件夹,而在基于Unix的系统上,用:分隔.

You need to add your current directory to the classpath with a .. On windows-based systems you separate folders with a ; while on a unix-based systems you separate with a :.

Windows示例:my/path/1;.(添加路径my/path/1和当前目录)

Windows Example : my/path/1;. (Adds path my/path/1 and the current directory)

Unix示例:my/path/1:.(添加路径my/path/1和当前目录)

Unix example: my/path/1:. (Adds path my/path/1 and the current directory)

这篇关于找不到类JUNIT org.junit.runner.JUnitCore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆