I'm running a ScalaTest (FlatSpec
) suite programmatically, like so:
new MyAwesomeSpec().execute()
Is there some way I can figure out if all tests passed? Suite#execute()
returns Unit
here, so does not help. Ideally, I'd like to run the whole suite and then get a return value indicating whether any tests failed; an alternative would be to fail/return immediately on any failed test.
I can probably achieve this by writing a new FlatSpec
subclass that overrides the Scalatest Suite#execute()
method to return a value, but is there a better way to do what I want here?