Agent Skills: Rust Testing Best Practices

Rust testing patterns for CLI applications, libraries, and frameworks. This skill should be used when writing, reviewing, or refactoring Rust tests including unit tests, integration tests, mocking, async testing, and CI integration. Triggers on tasks involving Rust testing, cargo test, mockall, proptest, tokio test, or test organization.

UncategorizedID: pproenca/dot-skills/rust-testing

Install this agent skill to your local

pnpm dlx add-skill https://github.com/pproenca/dot-skills/tree/HEAD/skills/.experimental/rust-testing

Skill Files

Browse the full folder contents for rust-testing.

Download Skill

Loading file tree…

skills/.experimental/rust-testing/SKILL.md

Skill Metadata

Name
rust-testing
Description
Rust testing patterns for CLI applications, libraries, and frameworks. This skill should be used when writing, reviewing, or refactoring Rust tests including unit tests, integration tests, mocking, async testing, and CI integration. Triggers on tasks involving Rust testing, cargo test, mockall, proptest, tokio test, or test organization.

Rust Testing Best Practices

Comprehensive testing guide for Rust applications, covering CLI testing, library testing, async patterns, and CI integration. Contains 42 rules across 8 categories, prioritized by impact to guide test design, mocking strategies, and CI optimization.

When to Apply

Reference these guidelines when:

  • Writing unit tests for Rust libraries or modules
  • Creating integration tests for CLI applications
  • Setting up mocking with mockall or trait-based design
  • Testing async code with Tokio
  • Configuring CI pipelines for Rust projects

Rule Categories by Priority

| Priority | Category | Impact | Prefix | |----------|----------|--------|--------| | 1 | Test Organization | CRITICAL | org- | | 2 | Mocking and Test Doubles | CRITICAL | mock- | | 3 | Async Testing | HIGH | async- | | 4 | Property-Based Testing | HIGH | prop- | | 5 | Test Fixtures and Setup | MEDIUM | fix- | | 6 | Assertions and Error Testing | MEDIUM | assert- | | 7 | CI Integration | MEDIUM | ci- | | 8 | Test Performance | LOW-MEDIUM | perf- |

Quick Reference

1. Test Organization (CRITICAL)

2. Mocking and Test Doubles (CRITICAL)

3. Async Testing (HIGH)

4. Property-Based Testing (HIGH)

5. Test Fixtures and Setup (MEDIUM)

6. Assertions and Error Testing (MEDIUM)

7. CI Integration (MEDIUM)

8. Test Performance (LOW-MEDIUM)

How to Use

Read individual reference files for detailed explanations and code examples:

Reference Files

| File | Description | |------|-------------| | references/_sections.md | Category definitions and ordering | | assets/templates/_template.md | Template for new rules | | metadata.json | Version and reference information |