org.scalatest.Suite run, .
. , Reporter. ad-hoc:
val reporter = new Reporter() {
override def apply(e: Event) = {}
}
, :
import org.scalatest.events.Event
import org.scalatest.{Args, Reporter}
val testSuite = new MyAwesomeSpec()
val testNames = testSuite.testNames
testNames.foreach(test => {
val result = testSuite.run(Some(test), Args(reporter))
val status = if (result.succeeds()) "OK" else "FAILURE!"
println(s"Test: '$test'\n\tStatus=$status")
})
, :
Test: 'This test should pass'
Status=OK
Test: 'Another test should fail'
Status=FAILURE!
, .