Stellar · Soroban · Test tooling
Soroban Testkit
Soroban Testkit is an open-source testing and debugging framework for Soroban smart contracts. It layers ergonomic fixtures, assertions, budget introspection and property-testing strategies on top of the official SDK, so contract tests are shorter, faster to write, and far closer to how they behave on-chain.
Why Testkit
The Soroban SDK ships solid primitives — Env::default(), testutils, event inspection — but day-to-day contract testing still has rough edges that every team re-solves on its own.
The Crates
Each crate is independent — adopt one, or combine all four for a complete testing stack.
Inspect & measure
Budget snapshots with call-level diffs, on-chain error decoding, and storage inspection across instance, persistent and temporary tiers.
Assert fluently
Readable matchers for contract events and authorizations, filterable by contract id and topic.
Set up once
A reusable test context plus a builder for environments, admin accounts and generated users.
Generate wildly
Property-testing strategies for token amounts, ledger sequences and timestamps that respect Soroban limits.
Architecture
soroban-testkit/ Cargo workspace, resolver 2
├── crates/soroban-testkit-core budget snapshots · error decoding · storage
├── crates/soroban-testkit-assert event matchers · authorization matchers
├── crates/soroban-testkit-fixtures test context · context builder
└── crates/soroban-testkit-generators proptest strategies · arbitrary impls
A First Look
Build a context, register the contract, invoke a call, then assert on events and budget in the same breath.
#![allow(unused)]
fn main() {
use soroban_testkit_assert::events::EventMatcher;
use soroban_testkit_fixtures::TestContext;
#[test]
fn transfer_emits_event() {
let ctx = TestContext::new();
// arrange: register your contract against ctx.env
// act: invoke the contract client
EventMatcher::new(&ctx.env).assert_emitted();
}
}
Full walkthroughs live in Quick Start, Testing Patterns and Budget-Aware Testing.
Stellar Wave
This project is funded through the Stellar Wave program on Drips Network. Every issue carries a complexity label — Trivial 100 pts Medium 150 pts High 200 pts — and rewards land once your PR is merged.
Pick up an issueBuilt and maintained by Stellar Crucible · Apache-2.0 licensed · contributions welcome.