Rust Testing

SkillDev tools

Patterns for Rust testing in Axone CosmWasm contracts. Use when adding unit tests, integration tests, data-driven cases, or coverage-oriented test scenarios.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Rust Testing skill

What this skill tells your AI

The instructions your AI receives, as published by axone-protocol/contracts in .agents/skills/rust-testing/SKILL.md and read by ahel’s review.

Coverage Targets

ComponentTarget
Handlers100%
State operations100%
Error paths90%+
Message parsing80%+
Overall90%+

Minimum Cases to Cover

  • For handlers: cover the happy path, parameter variations, error paths, and resulting state changes.
  • For queries: cover empty state, populated state, pagination behavior, and non-existent items.
  • For state transitions: cover initial state, updates after execute, and persistence across operations.

Running Tests

# Run all unit tests
cargo make test-unit

# Run all tests (includes integration)
cargo make test

# Run tests with coverage
cargo make test-coverage

# Run specific test
cargo test test_name -- --nocapture

Coverage output is written to lcov.info.

Viewing Coverage

# Generate HTML report (requires lcov)
genhtml lcov.info --output-directory coverage/

# Or use cargo-llvm-cov directly
cargo llvm-cov --html --open

Test Design Rules

  1. Isolate tests. Each test should set up its own environment.
  2. Test contract behavior, not framework internals.
  3. Assert exact errors when possible.
  4. Cover edge cases such as zero values, empty strings, and upper bounds.
  5. Prefer descriptive test names without a test_ prefix.
  6. Use tuple-driven cases for simple matrices and structs only when the case shape needs named fields.

References

  • For cw-orch integration harness patterns and common integration scenarios, read integration-patterns.
  • For naming and data-driven test examples, read test-style.

Signals

GitHub stars
123
Forks
19
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
rust-testing
Source
github.com/axone-protocol/contracts