rust-testing

Generates Rust test patterns for unit, integration, async, and property-based testing with mocking, doctests, benchmarking, and CI coverage via cargo-llvm-cov.

1|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/riftzen-bit/gemini-setup --skill rust-testing-riftzen-bit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-testing
Source: https://github.com/riftzen-bit/gemini-setup/tree/main/skills/rust-testing
Command: npx skills add https://github.com/riftzen-bit/gemini-setup --skill rust-testing-riftzen-bit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing comprehensive, maintainable tests in Rust across unit, integration, async, and property-based scenarios can be time-consuming and inconsistent, making it hard to follow TDD and meet coverage goals; this Skill consolidates patterns and best practices to streamline that work and reduce regressions.

Core Features & Use Cases

  • TDD workflow: RED-GREEN-REFACTOR guidance for writing failing tests first and iterating safely.
  • Test types covered: Unit tests, module organization, integration tests, async tests with Tokio, doctests, benchmarking with Criterion, and CI-friendly patterns.
  • Advanced techniques: Property-based testing strategies, trait-based mocking, test helpers and fixtures, and coverage measurement with cargo-llvm-cov for CI gating.

Quick Start

Write a failing test for the smallest behavior you need, implement the minimal code to make it pass, run tests with cargo test, and then generate coverage with cargo llvm-cov to verify thresholds.

Frequently Asked Questions about rust-testing

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

FAQPage Schema
How do I write async tests in Rust using Tokio?

Write async tests in Rust by applying Tokio runtime patterns to execute and assert asynchronous code behavior reliably. The Skill provides practical guidance for structuring asynchronous tests with Tokio to prevent race conditions and ensure maintainable test suites.

How do I enforce Rust test coverage thresholds in CI?

Enforce Rust test coverage thresholds in CI by generating reports with cargo-llvm-cov to gate merges on minimum coverage. The Skill outlines CI-friendly patterns and coverage measurement strategies to satisfy developer requirements for continuous integration enforcement.

What is the best way to mock traits in Rust tests?

The best way to mock traits in Rust tests is using trait-based mocking strategies with the mockall crate. The Skill details practical patterns for configuring mockall expectations to isolate modules and simulate external dependencies safely.

How do I apply TDD workflows in Rust?

Apply TDD workflows in Rust by following the RED-GREEN-REFACTOR cycle to write failing tests first, implement minimal code, and iterate safely. The Skill consolidates TDD best practices to streamline unit, integration, and complex test scenarios while reducing regressions.

Can I run property-based testing in Rust with proptest?

Yes, you can run property-based testing in Rust using proptest to validate code against a wide range of generated inputs. The Skill provides property-based testing strategies to automatically discover edge cases that traditional unit tests might miss.

How do I benchmark Rust code with Criterion?

Benchmark Rust code with Criterion to measure and track performance regressions across code changes in CI. The Skill covers benchmarking patterns alongside doctests and test organization to ensure comprehensive performance and functional validation.