Skip to content

macalinao/testsvm

Repository files navigation

TestSVM

github crates.io docs.rs build status

TestSVM is a blazing fast testing framework for Solana programs, written in Rust.

TestSVM provides:

  • Account labeling and logging, so you can easily track what Pubkey maps to what account.
  • Assertions for transaction results: assert that a transaction fails with a specific error, or that it succeeds.
  • Nicely formatted transaction logs with account labeling, so you know what accounts have issues in a transaction.
  • Type-safe utilities for validating state and loading it from the SVM.

Built on top of LiteSVM, tests written using TestSVM are an order of magnitude faster than traditional solana-test-validator + JavaScript tests.

Note: this is a work in progress and is subject to change.

Examples

The testsvm-quarry crate contains a number of tests that demonstrate all TestSVM features in tests/.

I plan to add more examples in the future.

Crates

There are two main crates that compose TestSVM:

  • testsvm - Core testing framework
  • testsvm-quarry - Helpers for testing programs that integrate with Quarry

Internal crates

The following crates are used internally by TestSVM, but are not documented or intended for public use.

  • solana-address-book - Keeps track of all the addresses used in the tests
  • anchor-utils - Lightweight utilities for interacting with programs that use Anchor.

Demo

Below is a screenshot of what happens when a test fails: detailed labels and logs of what accounts were involved in the transaction, what accounts were writable, and what error was thrown.

Demo of address book

License

Copyright (c) 2025 Ian Macalinao. Licensed under the Apache License, Version 2.0.

About

TestSVM is a blazing fast testing framework for Solana programs, written in Rust.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages