Payloads

org.scalatest.Payloads
See thePayloads companion trait
object Payloads extends Payloads

Companion object that facilitates the importing of Payloads members as an alternative to mixing it in. One use case is to import Payloads members so you can use them in the Scala interpreter.

Attributes

Companion
trait
Graph
Supertypes
trait Payloads
class Object
trait Matchable
class Any
Self type
Payloads.type

Members list

Value members

Inherited methods

def withPayload[T](payload: => Any)(fun: => T): T

Executes the block of code passed as the second parameter, and, if it completes abruptly with a ModifiablePayload exception, replaces the current payload contained in the exception, if any, with the one passed as the first parameter.

Executes the block of code passed as the second parameter, and, if it completes abruptly with a ModifiablePayload exception, replaces the current payload contained in the exception, if any, with the one passed as the first parameter.

This method allows you to insert a payload into a thrown Payload exception (such as a TestFailedException), so that payload can be included in events fired to a custom reporter that can make use of the payload. Here's an example in which a GUI snapshot is included as a payload when a test fails:

withPayload(generateGUISnapshot()) {
 1 + 1 should === (3)
}

Attributes

Inherited from:
Payloads