Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SBT doesn't reconize junit testcase written in java file

I made a Scala/Java mixed project with SBT 0.11.2. My config for JUnit testing is

resolvers += "twitter.com" at "http://maven.twttr.com/"

seq(com.github.retronym.SbtOneJar.oneJarSettings: _*)

libraryDependencies += "com.novocode" % "junit-interface" % "0.10-M2" % "test"

When I write JUnit test cases in Scala with @Test, every goes well. But when I write a Java JUnit test case, then run test in sbt, the Java JUnit test cannot be reconized. Only test cases written in Scala are executed.

How can I make sbt recognize my Java and Scala test cases at the same time?

like image 931
CharlieQ Avatar asked Nov 15 '12 15:11

CharlieQ


2 Answers

Probably late for the origional question, but..

I've just been looking at this. The JUnit tests in my project were not running for me until I ran sbt clean test. Now all working like a charm.

like image 113
Oliver Shaw Avatar answered Nov 09 '22 23:11

Oliver Shaw


There was a bug in 0.11.x in detecting Java tests that was fixed in 0.12.0, although I didn't think it affected detecting annotated tests. You might try coming up with a minimal test case and checking with the latest sbt version (0.12.1). If the problem still exists, file a bug.

like image 22
Mark Harrah Avatar answered Nov 10 '22 00:11

Mark Harrah