With Simple Build Tool v0.7.3 it is now possible to find and execute JUnit tests without modifying them. It requires a patched version of junit-interface to be included as a test dependency. Here's how:
Until there's a version 0.4 of junit-interface, get v0.3 from http://github.com/szeiger/junit-interface
tar zxf szeiger-junit-interface-6671824.tar.gz
cd szeiger-junit-interface-6671824/
Get and apply the patch that will enable this to find native JUnit @Test annotations. Download szeiger_junit_interface_0.5.patch from http://groups.google.com/group/simple-build-tool/files and save as 'patch'. Then execute
git apply patch
Build and publish junit interface locally.
sbt clean update publish-local
Add the following line to the project definition for your project
val junitInterface = "com.novocode" % "junit-interface" % "0.4" % "test"
Follow up with
sbt clean update test
Provided you are on 0.7.3 of SBT, tests marked with the JUnit @Test annotation will have been executed.
Advertisement

Leave a comment
Comments feed for this article