我在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");
答案 0 :(得分:1)
似乎你的类路径不正确,有些文件夹没有标题斜杠,试着纠正它们并编译