specs2 indeed doesn't know about Junit categories yet. In a meantime a workaround is to use tags:
import org.specs2.specification.Tags
@RunWith(classOf[JUnitRunner])
class MyTest extends Specification with Tags { section("NightlyTest")
"My Test" should {
"succeed" in {
done
}
}
}
Then if you add, as system argument, -Dspecs2.include=NightlyTest
only this specification will be executed. However this means that you cannot use the
"groups" configuration from Surefire and you will have to use Maven profiles.
Another option is to use all of JUnit/Maven infrastructure and reuse specs2 matchers only:
import org.specs2.matcher._
@RunWith(classOf[JUnit4])
@Category(Array(classOf[NightlyTestCategory]))
class MyTest extends JUnitMatchers {
@Test
def test = { 1 must_== 1 }
}