> ## Documentation Index
> Fetch the complete documentation index at: https://docs.goakt.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Testing Strategy

> TestKit, mocks, and integration tests.

## Test layout

Tests are co-located with source code in `_test.go` files. There is no separate `test/` directory for unit tests.

## TestKit

The `testkit` package provides helpers for actor-level testing. See [TestKit](/actor/testkit) for full documentation.

* **TestKit**: Creates a throwaway actor system. Provides Spawn, SpawnChild, Kill, Subscribe, NewProbe, NewGrainProbe, plus the package-level GrainOf and NodeGrainOf helpers for grain identities.
* **Probe** — Test actor that records messages. Assertions: ExpectMessage, ExpectMessageOfType, ExpectNoMessage, ExpectTerminated; Send, SendSync; Watch, WatchNamed.
* **GrainProbe** — Similar for grain testing.
* **MultiNodes** — Multi-node cluster in-process for integration tests.

Use probes instead of sleeps or polling for message assertions.

## Integration tests

Tests needing real infrastructure (Consul, etcd) use **testcontainers-go**. Docker is required. See `discovery/consul/`
and `discovery/etcd/` for patterns.

## Mocks

Generated by mockery. Pre-built mocks in `mocks/` cover Remoting, Cluster, Extension, Dependency, Provider. Use them to
isolate components in unit tests.

## Conventions

* New public types or behavior changes should have test coverage
* Prefer TestKit probes for message-level assertions
* Use testcontainers for external infrastructure—don't assume services on the host
