standards-rust-testing

Standardize Rust testing patterns across unit, integration, and property-based tests.

2|Updated Apr 10, 2024
One-click install
npx skills add https://github.com/gdurandvadas/dotfiles --skill standards-rust-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: standards-rust-testing
Source: https://github.com/gdurandvadas/dotfiles/tree/main/config/opencode/skills/standards-rust-testing
Command: npx skills add https://github.com/gdurandvadas/dotfiles --skill standards-rust-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rust projects often struggle with inconsistent testing patterns across unit, integration, doctest, and property-based testing, making reviews and CI harder to standardize.

Core Features & Use Cases

  • Provides a set of idiomatic Rust testing patterns including unit tests with #[cfg(test)], integration tests under tests/, doctests in doc comments, and property-based testing with proptest.
  • Supports benchmarks with Criterion, fuzzing with cargo-fuzz, and snapshot testing with insta to improve test reliability and observability.
  • Guides CI configuration and code-review practices to ensure consistent testing discipline across a codebase.

Quick Start

Run cargo test --all-features to validate your project against Rust testing standards.

Frequently Asked Questions about standards-rust-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure unit tests and integration tests in Rust?

Idiomatic Rust testing structures unit tests within source files using #[cfg(test)] and places integration tests in a separate tests/ directory. This separation ensures consistent test discipline and standardizes code review workflows across the project.

What is the best way to set up property-based testing and snapshot testing in Rust?

Property-based testing in Rust is standardized using the proptest crate, while snapshot testing is handled by the insta crate. These tools enforce consistent testing patterns, improving test reliability and observability for complex Rust codebases.

How do I configure CI workflows to enforce consistent Rust testing standards?

You can enforce Rust testing standards in CI workflows by validating projects with cargo test --all-features. This command ensures all unit tests, integration tests, and doctests pass according to the project's idiomatic testing patterns.

Does Rust support doctests alongside unit and integration tests?

Yes, Rust supports doctests by embedding executable test cases directly within doc comments. This approach standardizes documentation verification alongside unit tests and integration tests to maintain comprehensive codebase coverage.

What tools should I use for benchmarking and fuzzing in a Rust project?

Rust testing standards specify Criterion for benchmarks and cargo-fuzz for fuzzing. These tools guide the adoption of consistent performance and security testing patterns during development and CI maintenance.

Why do I need standardized Rust testing patterns for code reviews?

Standardized Rust testing patterns are needed to resolve inconsistent practices across unit, integration, and property-based tests. Enforcing idiomatic patterns makes code reviews and CI workflows easier to standardize and maintain.