Outcome

sealed abstract class Outcome extends Product with Serializable

Superclass for the possible outcomes of running a test.

Outcome is the result type of the withFixture methods of traits Suite and FixtureSuite, as well as their NoArgTest and OneArgTest function types. The four possible outcomes are:

  • Succeeded - indicates a test succeeded

  • Failed - indicates a test failed and contains an exception describing the failure

  • Canceled - indicates a test was canceled and contains an exception describing the cancelation

  • Pending - indicates a test was pending

Note that "ignored" does not appear as a type of Outcome, because tests are marked as ignored on the outside and skipped over as the suite executes. So an ignored test never runs, and therefore never has an outcome. By contrast, a test is determined to be pending by running the test and observing the actual outcome. If the test body completes abruptly with a TestPendingException, then the outcome was that the test was pending.

Companion:
object
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
class Canceled
class Failed
object Pending.type
object Succeeded.type

Value members

Abstract methods

Converts this Outcome to a Succeeded.

Converts this Outcome to a Succeeded.

When this Outcome instance is not Succeeded, it behaves as followed:

  • Failed(ex) - throws ex

  • Canceled(tce) - throws tce

  • Pending - throws TestPendingException

Returns:

Succeeded if this Outcome instance is a Succeeded.

Concrete methods

def toOption: Option[Throwable]

Converts this Outcome to an Option[Throwable].

Converts this Outcome to an Option[Throwable].

This class's implementation of this method always returns None.

Returns:

a Some wrapping the contained exception if this Outcome is an instance of either Failed or Canceled.

Inherited methods

def canEqual(that: Any): Boolean
Inherited from:
Equals
def productArity: Int
Inherited from:
Product
def productElement(n: Int): Any
Inherited from:
Product
def productElementName(n: Int): String
Inherited from:
Product
def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product
def productPrefix: String
Inherited from:
Product

Concrete fields

val isCanceled: Boolean

Indicates whether this Outcome represents a test that was canceled.

Indicates whether this Outcome represents a test that was canceled.

This class's implementation of this method always returns false.

Returns:

true if this Outcome is an instance of Canceled.

val isExceptional: Boolean

Indicates whether this Outcome represents a test that either failed or was canceled, in which case this Outcome will contain an exception.

Indicates whether this Outcome represents a test that either failed or was canceled, in which case this Outcome will contain an exception.

Returns:

true if this Outcome is an instance of either Failed or Canceled.

val isFailed: Boolean

Indicates whether this Outcome represents a test that failed.

Indicates whether this Outcome represents a test that failed.

This class's implementation of this method always returns false.

Returns:

true if this Outcome is an instance of Failed.

val isPending: Boolean

Indicates whether this Outcome represents a test that was pending.

Indicates whether this Outcome represents a test that was pending.

This class's implementation of this method always returns false.

Returns:

true if this Outcome is an instance of Pending.

val isSucceeded: Boolean

Indicates whether this Outcome represents a test that succeeded.

Indicates whether this Outcome represents a test that succeeded.

This class's implementation of this method always returns false.

Returns:

true if this Outcome is an instance of Succeeded.