I have a 0.13.7 SBT project, with several sub-projects.
One of them is called webapp, and it has many JUnit tests in webapp/src/test/
Finally, I've discovered, that I have to add the following settings to the subproject:
lazy val webapp = project
settings(
Seq(
projectDependencies ++= Seq(
....
"org.scalatest" %% "scalatest" % "2.2.2" % Test,
"junit" % "junit" % "4.11" % Test,
crossPaths := false,
"com.novocode" % "junit-interface" % "0.11" % Test
)
): _*
)
It is important to declare the junit-interface dependency in the subproject, and in addition, to set to false the crossPaths setting.
The clue has been given by this issue.
If the main project doesn't have JUnit tests, then the needed test settings, don't need to be provided.
In addition, for knowing the failing method and the cause, we need this setting:
testOptions in Test := Seq(Tests.Argument(TestFrameworks.JUnit, "-a"))