2
votes

I am having difficulties getting sbt (version 0.12.1) to recognize any tests in src/test/scala.

I have tried both JUnit style tests and scalatest style tests but to no avial

To make things simple

  • I have moved my tests to the root package (src/test/scala)

  • I have included both org.scalatest and junit-interface in my build.sbt libraryDependencies ++= List( "org.scalatest" %% "scalatest" % "1.8" % "test", "com.novocode" % "junit-interface" % "0.8" % "test->default" )

  • I have made the tests as simple as possible:

  • scalatest example

    import org.scalatest.FunSuite import scala.collection.mutable.Stack

    class ExampleSuite extends FunSuite {

    test("math still works") { assert(1+1 == 2) } }

  • junit test example: import org.junit.Assert._ import org.junit.Test

    class SimpleTest {

    @Test def testPass() { assertEquals(1+1, 2) }

    }

  • my test structure is: src/test/scala

    ├── FunSuiteExample.scala

    └── SimpleTest.scala

What am I missing?

1
What is the console output from sbt test?Schleichardt

1 Answers

3
votes

based on instructions at:

https://github.com/szeiger/junit-interface

modfied build.sbt

  • removed "junit" % "junit" % "4.10" % "test" from build.sbt
  • added "com.novocode" % "junit-interface" % "0.11" % "test"

put test in src/test/scala

import org.junit._
import org.junit.Assert._


class SimpleTeset {

  @Test
  def testTrue() {
    assertEquals(1+1, 2)
  }
}