junit-interface icon indicating copy to clipboard operation
junit-interface copied to clipboard

JUnit Tests Ignored when Forking is Enabled

Open malaverdiere opened this issue 7 years ago • 0 comments

I have a Java project that I'm building with SBT. The only Scala code is in the tests. I need to run some slow tests in a separate process, with a high memory option (-Xmx). I want to do that using forking. However, this does not work, as JUnit tests are ignored.

This is an excerpt of my build.sbt:

crossPaths := false
scalaVersion := "2.12.4"
autoScalaLibrary := false
sbtVersion := "1.1.1"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.3" % "test"
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.13.5" % "test"
libraryDependencies += "junit" % "junit" % "4.12" % "test"
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
testOptions += Tests.Argument(TestFrameworks.JUnit, "-q")
Test / parallelExecution := false

This configuration makes my jUnit tests run when I do sbt test. If I add fork in Test := true, then only my ScalaTest tests execute.

malaverdiere avatar Mar 16 '18 02:03 malaverdiere