Installation
Add only the crates your test suite needs. All four are published on crates.io as soroban-testkit-core, soroban-testkit-assert, soroban-testkit-fixtures and soroban-testkit-generators. If you would rather pin the source, every release is also tagged — a tag points at a commit whose CI (tests, clippy and the cargo deny supply-chain gate) is green.
Add the dev-dependencies
[dev-dependencies]
soroban-testkit-core = "0.3.0"
soroban-testkit-assert = "0.3.0"
soroban-testkit-fixtures = "0.3.0"
soroban-testkit-generators = { version = "0.3.0", features = ["proptest"] }
The same set pinned to the release tag:
[dev-dependencies]
soroban-testkit-core = { git = "https://github.com/stellar-crucible/soroban-testkit", tag = "v0.3.0" }
soroban-testkit-assert = { git = "https://github.com/stellar-crucible/soroban-testkit", tag = "v0.3.0" }
soroban-testkit-fixtures = { git = "https://github.com/stellar-crucible/soroban-testkit", tag = "v0.3.0" }
soroban-testkit-generators = { git = "https://github.com/stellar-crucible/soroban-testkit", tag = "v0.3.0", features = ["proptest"] }
Install steps
-
Check your toolchain
Soroban SDK v28 needs a recent Cargo. Run
rustc --versionand upgrade withrustup update stableif it reports anything below 1.91. -
Pin the SDK your contract already uses
Testkit is built against SDK v28. Match the
soroban-sdkversion in your contract crate so thetestutilsfeatures resolve to one copy. -
Enable
testutilsin testsAddress generation, event inspection and auth recording are gated behind the SDK's
testutilsfeature — the dev-dependency above turns it on for the test profile only. -
Verify the wiring
Run
cargo test. A green compile means the crates are linked; the Quick Start gives you a first test to paste in.
Feature flags
soroban-testkit-generators
| Feature | Description |
|---|---|
proptest (default) | Enable proptest strategies |
arbitrary | Enable arbitrary trait implementations |
Testkit is pre-1.0. A 0.x release may break the API, so pin an exact version or a release tag once your suite is green — cargo update can otherwise pull breaking changes from a newer 0.x.