本文へ移動
cccskills
無料GitHub で公開

rust-testing

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

インストール方法を見る

含まれるファイル(3)

  • SKILL.md2.0 KB
  • references/integration-patterns.md3.3 KB
  • references/test-style.md2.0 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Rust Testing

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.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Best practices for designing CosmWasm smart contract APIs. Use when defining message types, designing execute/query interfaces, or optimizing API ergonomics.

日本語の概要は準備中です。原文の説明を表示しています。

axone-protocol/contracts1232026年10月9日 更新

Guide for writing Rust doc comments that produce accurate generated contract documentation. Use when editing Instantiate/Execute/Query/Response types or any public schema-facing API.

日本語の概要は準備中です。原文の説明を表示しています。

axone-protocol/contracts1232026年10月9日 更新

Guide for writing conventional commit messages. Use when committing changes, writing commit messages, or reviewing commit history.

日本語の概要は準備中です。原文の説明を表示しています。

axone-protocol/contracts1232026年10月9日 更新

Axone contract structure and Abstract SDK patterns. Use when scaffolding or refactoring contracts, deciding layer boundaries, wiring AppContract entrypoints, or adding module metadata and replies.

日本語の概要は準備中です。原文の説明を表示しています。

axone-protocol/contracts1232026年10月9日 更新

Axone deployment workflows with cargo-make, cw-orch, and Abstract. Use when publishing modules, installing them on accounts, running local chain tasks, or inspecting deployments.

日本語の概要は準備中です。原文の説明を表示しています。

axone-protocol/contracts1232026年10月9日 更新

Guide for regenerating Axone contract schemas and rendered Markdown docs. Use when contract APIs or metadata change, when checking generated-doc drift, or when preparing documentation commits.

日本語の概要は準備中です。原文の説明を表示しています。

axone-protocol/contracts1232026年10月9日 更新

axone-protocol のスキルをすべて見る

このスキルの問題を報告する