Skip to main content
The testkit package provides helpers for actor-level testing. It creates a throwaway actor system, probes for message assertions, and supports grain testing.

TestKit

Options

Probe

A probe is a test actor that records messages. Use it to assert message delivery instead of sleeps or polling.

Probe interface

Default timeout is 3 seconds. Probes work in both standalone and cluster mode.

Asserting child actor creation

When an actor spawns a child during message handling, use ExpectChildSpawned to verify:

GrainProbe

Similar to Probe but for grains. Use the package-level testkit.GrainOf[T] function (or testkit.NodeGrainOf[T] on a cluster test node) to create identities, then send and assert responses.

MultiNodes

For integration tests, MultiNodes creates an in-process multi-node cluster. See testkit/multi_nodes.go for usage. Requires cluster and remoting configuration.

Usage pattern