繁体   English   中英

使用junit设置类路径时出错

[英]Error in setting classpath with junit

我在Java项目上运行jUnit测试。

我的课程位于目录中:

/home/dario/testEnv/151337/prefix/rhino/build/classes

我的测试在目录中:

/home/dario/testEnv/151337/prefix/rhino/evosuite-tests/org/mozilla/javascript

我尝试运行的测试是“ EcmaErrorEvoSuiteTest.java”,它是org.mozilla.javascript软件包的一部分

我的类路径设置为:

/home/dario/testEnv/151337/prefix/rhino/build/classes:home/dario/testEnv/151337/prefix/rhino/evosuite-tests:home/dario/testEnv/684131/prefix/rhino/lib/xbean.jar:/home/dario/evosuite/target/evosuite-0.1-SNAPSHOT-jar-minimal.jar

当我尝试编译时,我没有错误:

javac evosuite-tests/org/mozilla/javascript/EcmaErrorEvoSuiteTest.java

但是,当我尝试运行测试时,得到以下信息:

java org.junit.runner.JUnitCore org.mozilla.javascript.EcmaErrorEvoSuiteTest
JUnit version 4.11
Could not find class: org.mozilla.javascript.EcmaErrorEvoSuiteTest

Time: 0.002

有人有任何建议吗?

测试课开始:

/*
 * This file was automatically generated by EvoSuite
 */

package org.mozilla.javascript;

import static org.junit.Assert.*;
import org.junit.Test;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.EcmaError;
import org.mozilla.javascript.NativeGlobal;
import org.mozilla.javascript.Scriptable;

public class EcmaErrorEvoSuiteTest {


  //Test case number: 0
  /*
   * 2 covered goals:
   * 1 org.mozilla.javascript.EcmaError.getName()Ljava/lang/String;: root-Branch
   * 2 org.mozilla.javascript.EcmaError.<init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;I)V: root-Branch
   */

  @Test
  public void test0()  throws Throwable  {
      // Undeclared exception!
      try {
        Context.getContext();
        fail("Expecting exception: RuntimeException");

      } catch(RuntimeException e) {
         //
         // No Context associated with current Thread
         //
      }
  }

  //Test case number: 1
  /*
   * 2 covered goals:
   * 1 org.mozilla.javascript.EcmaError.details()Ljava/lang/String;: root-Branch
   * 2 org.mozilla.javascript.EcmaError.<init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;I)V: root-Branch
   */

  @Test
  public void test1()  throws Throwable  {
      // Undeclared exception!
      try {
        Context.getContext();
        fail("Expecting exception: RuntimeException");

似乎您的类路径不正确,某些文件夹没有标题斜杠,请尝试更正它们并进行编译

  • / home / dario / testEnv / 151337 / prefix / rhino / build / classes-绝对
  • 主页/ dario / testEnv / 151337 / prefix / rhino / evosuite-tests-相对(无标题斜线)

暂无
暂无

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

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