Skip to content
Skills Library
Programming · Testing

rust-testing

/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.

Repository
contracts ↗
Licence
BSD-3-Clause
Last repository change
27.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

BSD-3-Clause, otwarta.

What it does and when to use it

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

Original author description

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

How it works

  1. Coverage Targets
  2. Minimum Cases to Cover
  3. Running Tests
  4. Viewing Coverage
  5. Test Design Rules
  6. References
Original SKILL.md headings · 61 lines, 250 words
SKILL.md preview
---
name: rust-testing
description: Patterns for Rust testing in Axone CosmWasm contracts. Use when adding unit tests, integration tests, data-driven cases, or coverage-oriented test scenarios.
license: BSD-3-Clause
metadata:
  author: axone.xyz
  version: "1.0"
---

# Rust Testing

## Coverage Targets

| Component            | Target |
| -------------------- | ------ |
| **Handlers**         | 100%   |
| **State operations** | 100%   |
| **Error paths**      | 90%+   |
| **Message parsing**  | 80%+   |
| **Overall**          | 90%+   |

## 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

```bash
# 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

```bash
# 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](./references/integration-patterns.md).
- For naming and data-driven test examples, read [test-style](./references/test-style.md).
Files in this package (3)
  • SKILL.md 2 KB
  • references/integration-patterns.md 3 KB
  • references/test-style.md 2 KB

Versions

RepositoryScoreLicence
This page · axone-protocol/contracts100BSD-3-Clause
xobotyi/cc-foundry100MIT
affaan-m/ECC100MIT
claude-dev-suite/claude-dev-suite100MIT
SHRIJANAGAIN/Nemo-Cli100Apache-2.0
AutumnsGrove/Lattice100AGPL-3.0
full-stack-skills/rust-skills100Apache-2.0
rewrite-rs/skills95BSD-3-Clause
cybercoretech/cybercore-agent-skills90MIT

Database snapshot: 13.11.2026 · package version a548818015a7 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100cosmwasm-contract
    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.
  • 100rust-contract-domain-modeling
    Domain-driven modeling patterns for Axone contracts. Use when introducing domain concepts, encoding invariants, or deciding boundaries between domain, handlers, services, gateways, queries, and state.
  • 100testing
    Apply comprehensive testing best practices including unit, integration, and e2e tests. Use when writing tests, reviewing test coverage, designing testable code, or setting up test infrastructure.
  • 100testing-patterns
    Testing patterns for unit, integration, and end-to-end tests. Use when writing tests, setting up test fixtures, or validating RLS enforcement. Routes to existing test conventions.
  • 95test-specialist
    Test-writing patterns for JS/TS, Python, Go, and Rust (unit, integration, E2E, visual regression). Use only when the user explicitly asks for tests or test coverage; for debugging without a test request, use debug-systematic.
  • 100designing-tests
    Designs and implements testing strategies for any codebase. Use when adding tests, improving coverage, setting up testing infrastructure, debugging test failures, or when asked about unit tests, integration tests, or E2E testing.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.