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
- Alphabetic
- By Inheritance
- ActorTestKit
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Value Members
- val config: Config
-
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
-
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
- val name: String
- implicit def scheduler: Scheduler
- def shutdownTestKit(): Unit
-
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
-
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
-
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
-
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
-
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. - implicit def system: typed.ActorSystem[Nothing]
- implicit def testKitSettings: TestKitSettings
- implicit val timeout: Timeout