| Crates.io | soroban-test-helpers |
| lib.rs | soroban-test-helpers |
| version | 0.2.4 |
| created_at | 2025-03-14 17:52:10.547056+00 |
| updated_at | 2025-09-24 22:24:42.900801+00 |
| description | A collection of helpers for writing tests for Soroban contracts |
| homepage | |
| repository | https://github.com/OpenZeppelin/soroban-helpers |
| max_upload_size | |
| id | 1592547 |
| size | 10,048 |
A collection of utilities and macros to simplify testing Soroban smart contracts.
This crate provides helper utilities for writing cleaner, more concise tests for Soroban smart contracts.
#[test] attribute macro - Simplifies test setup by:
Add this to your Cargo.toml:
[dependencies]
soroban-test-helpers = "0.2.4"
use soroban_sdk::{Address, Env};
use soroban_test_helpers::test;
// Original test setup
#[test]
fn original_test_approach() {
let env = Env::default();
let user = Address::generate(&env);
let contract = Address::generate(&env);
// Test logic...
}
// Simplified test using soroban-test-helpers
#[test]
fn simplified_test(env: Env, user: Address, contract: Address) {
// Test logic...
// Environment setup is handled automatically!
}
The #[test] attribute macro transforms your test function by:
Default::default() for the first parameterAddress::generate(&env)This significantly reduces the amount of boilerplate code in your tests.
We welcome contributions from the community! Here's how you can get involved:
If you are looking for a good place to start, find a good first issue here.
You can open an issue for a bug report, feature request, or documentation request.
You can find more details in our Contributing guide.
Please read our Code of Conduct and check the Security Policy for reporting vulnerabilities.
This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.
If you discover a security vulnerability within this project, please see SECURITY.md for instructions on responsible disclosure.
See CODEOWNERS file for the list of project maintainers.