Packages

final class ActorTestKit extends AnyRef

Testkit for asynchronous testing of typed actors, meant for mixing into the test class.

Provides a typed actor system started on creation, used for all test cases and shut down when shutdown is called.

The actor system has a custom guardian that allows for spawning arbitrary actors using the spawn methods.

Designed to work with any test framework, but framework glue code that calls shutdown after all tests has run needs to be provided by the user.

For synchronous testing of a Behavior see BehaviorTestKit

Annotations
@ApiMayChange()
Source
ActorTestKit.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ActorTestKit
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. val config: Config
  2. def createTestProbe[M](name: String): TestProbe[M]

    Shortcut for creating a new named test probe for the testkit actor system

    Shortcut for creating a new named test probe for the testkit actor system

    M

    the type of messages the probe should accept

  3. def createTestProbe[M](): TestProbe[M]

    Shortcut for creating a new test probe for the testkit actor system

    Shortcut for creating a new test probe for the testkit actor system

    M

    the type of messages the probe should accept

  4. val name: String
  5. implicit def scheduler: Scheduler
  6. def shutdownTestKit(): Unit
  7. def spawn[T](behavior: Behavior[T], name: String, props: typed.Props): typed.ActorRef[T]

    Spawn the given behavior.

    Spawn the given behavior. This is created as a child of the test kit guardian

  8. def spawn[T](behavior: Behavior[T], name: String): typed.ActorRef[T]

    Spawn the given behavior.

    Spawn the given behavior. This is created as a child of the test kit guardian

  9. def spawn[T](behavior: Behavior[T], props: typed.Props): typed.ActorRef[T]

    Spawn the given behavior.

    Spawn the given behavior. This is created as a child of the test kit guardian

  10. def spawn[T](behavior: Behavior[T]): typed.ActorRef[T]

    Spawn the given behavior.

    Spawn the given behavior. This is created as a child of the test kit guardian

  11. def stop[T](ref: typed.ActorRef[T], max: FiniteDuration = timeout.duration): Unit

    Stop the actor under test and wait until it terminates.

    Stop the actor under test and wait until it terminates. It can only be used for actors that were spawned by this ActorTestKit. Other actors will not be stopped by this method.

  12. implicit def system: typed.ActorSystem[Nothing]
  13. implicit def testKitSettings: TestKitSettings
  14. implicit val timeout: Timeout