Skip to content

Instantly share code, notes, and snippets.

@edgarmueller
Created December 16, 2014 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edgarmueller/4a230e213385c061a010 to your computer and use it in GitHub Desktop.
Save edgarmueller/4a230e213385c061a010 to your computer and use it in GitHub Desktop.
package mytest
import org.specs2.execute.Details
import org.specs2.mutable._
import org.specs2.reporter.Notifier
class MyNotifier extends Notifier {
override def exampleFailure(name: String, message: String,
location: String, f: Throwable, details: Details, duration: Long) = {
println("Test failed")
}
/* other methods of Notifier follow here */
override def specStart(title: String, location: String): Unit = {
println("Spec started")
}
override def exampleStarted(name: String, location: String): Unit = ()
override def text(text: String, location: String): Unit = ()
override def contextEnd(text: String, location: String): Unit = ()
override def examplePending(name: String, message: String, duration: Long): Unit = ()
override def exampleSuccess(name: String, duration: Long): Unit = ()
override def exampleError(name: String, message: String, location: String, f: Throwable, duration: Long): Unit = ()
override def specEnd(title: String, location: String): Unit = {
println("Spec ended")
}
override def contextStart(text: String, location: String): Unit = ()
override def exampleSkipped(name: String, message: String, duration: Long): Unit = ()
}
class HelloWorldSpec extends Specification {
args.report(notifier = "mytest.MyNotifier")
"The 'Hello world' string" should {
"contain 11 characters" in {
"Hello world" must have size(10)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment