Mov Log

Articles

ScalaTest Eclipse

Hekar Khani

I tried the ScalaTest plugin Eclipse, but I couldn't get them working with my version of ScalaTest. Fortunately, there's an alternative: JUnit runners.


Found the perfect tutorial to get JUnit runners with ScalaTest working well in Eclipse.

Here's an example:

import org.junit.runner._
import org.scalatest._
import org.scalatest.junit._

@RunWith(classOf[JUnitRunner])
  class OneEqualOneSpec extends FunSuite {

    test("testing 1 = 1") {
      assert(1 == 1)
    }

  }

This example can run under standard Java JUnit configurations in Gradle, Maven and Ant. Making it easier to integrate with existing projects.