Using the Scala IDE for Eclipse with JUnit

Using JUnit4

  1. Go to the properties dialog of your project
  2. Go to the Java Build Path->Libraries tab and add an external class folder. Choose the bin folder of your project.
  3. Go to the Order and Export tab and move your new class path entry to the top or at least above your source folder(s).
  4. Add JUnit4 to the build path of your project if you haven't already.

The Eclipse JUnit runner should find your tests now, but only if you explicitly specify a test class in the launch configuration. Suppose you have a project junit4-test with a test class:

package a
 
import org.junit._
import Assert._
 
class Tests {
  @Test def sample() {
    assertEquals(42, 6*7)
  }
}

Your launch dialog should look like the following:

 

JUnit 4 launch configurationJUnit 4 launch configuration

Copyright © 2010 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland