Skip to main content

Crate neo_test

Crate neo_test 

Source
Expand description

Neo N3 Contract Testing Framework

This crate provides utilities for testing Neo N3 smart contracts with a mock runtime environment.

§Usage

use neo_test::*;

// Create a test environment
let mut env = TestEnvironment::new();

// Set up contract state
env.set_storage(b"owner", b"AV4GGdKS2C7j1GqC3w5y4qX5");

// Add witness
env.add_witness(b"AV4GGdKS2C7j1GqC3w5y4qX5");

// Assert
env.assert_storage().assert_contains(b"owner");
env.assert_runtime().assert_witness(b"AV4GGdKS2C7j1GqC3w5y4qX5");

Macros§

assert_neo
test_env

Structs§

ContractTest
MethodCallResult
Result of a contract method call for assertions
MockRuntime
Mock runtime for testing contract execution
MockRuntimeBuilder
Builder for creating mock runtime
MockStorage
Mock storage that simulates Neo blockchain storage
MockStorageContext
Mock storage context for simulating storage operations
RuntimeAssertions
Runtime assertions
StorageAssertions
Storage assertions
TestBuilder
TestEnvironment
Test environment for Neo N3 contract testing
TestError

Type Aliases§

TestResult