Frage

I am running jUnit tests on a java project.

My classes are located in the directory:

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

And my tests in the directory:

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

The test I am trying to run is "EcmaErrorEvoSuiteTest.java", which is part of the package org.mozilla.javascript

My classpath is set to:

/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

When I try compiling I get no error:

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

However, when I try running the tests I get the following:

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

Time: 0.002

Anybody got any suggestions?

Beginning of test-class:

/*
 * 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");
War es hilfreich?

Lösung

Seems that you class path incorrect, some folders do not have heading slashes, try to correct them and compile

  • /home/dario/testEnv/151337/prefix/rhino/build/classes - absolute
  • home/dario/testEnv/151337/prefix/rhino/evosuite-tests - relative (no heading slash)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top