Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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.

Rust1.91 or newer
Soroban SDK28.x
Edition2021
LicenseApache-2.0

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

  1. Check your toolchain

    Soroban SDK v28 needs a recent Cargo. Run rustc --version and upgrade with rustup update stable if it reports anything below 1.91.

  2. Pin the SDK your contract already uses

    Testkit is built against SDK v28. Match the soroban-sdk version in your contract crate so the testutils features resolve to one copy.

  3. Enable testutils in tests

    Address generation, event inspection and auth recording are gated behind the SDK's testutils feature — the dev-dependency above turns it on for the test profile only.

  4. 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

FeatureDescription
proptest (default)Enable proptest strategies
arbitraryEnable arbitrary trait implementations
Versioning

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.