Search code examples
scalaspecs2

Use specs2.runner with own notifier from command line


How can I call a self-written spec2 Notifier from the Java command line without using sbt. I want to do this:

java -cp "testJars/*" org.specs2.runner.files "**/*" <here add MyTestNotifier>

Addition: In SBT we can do that, it works like this:

sbt testOnly * -- notifier MyTestNotifier

I want to do it without "sbt" because the test then starts faster. I tried with (--notifier MyTestNotifier) at the end but unfortunately it didn't work

I read in the documentation that it works but unfortunately I don't know how

https://etorreborre.github.io/specs2/guide/SPECS2-3.9.5/org.specs2.guide.RunInShell.html#outputs


Solution

  • You can use a Java system property to pass the notifier name:

    java "-DSpecs2.notifier=MyTestNotifier" ...