rust-testing

Generate Rust unit, integration, and doc tests with rstest, mockall, and tokio.

7|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/chenziyang110/spec-kit-plus --skill rust-testing-chenziyang110
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-testing
Source: https://github.com/chenziyang110/spec-kit-plus/tree/main/templates/passive-skills/rust-testing
Command: npx skills add https://github.com/chenziyang110/spec-kit-plus --skill rust-testing-chenziyang110

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you produce correct, maintainable Rust test suites and diagnose why tests fail, instead of iterating blindly on behavior.

Core Features & Use Cases

  • Rust test generation with guardrails: creates focused unit, integration, or doc tests only when the request includes clear test intent and needed dev-dependencies.
  • Fixture and parameter coverage: uses rstest for fixtures and parametrization to cover happy paths and boundary/error cases.
  • Mocking and async support: applies mockall for trait boundaries and uses tokio::test when async runtime control is required.

Quick Start

Ask the agent to generate Rust tests for the specific function or module you are working on using cargo test conventions.

Frequently Asked Questions about rust-testing

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

FAQPage Schema
How do I generate Rust tests for async tokio functions?

You can generate Rust tests for async tokio functions by applying the tokio::test attribute to manage runtime behavior and output compilable test files for cargo test execution.

What is the best way to mock trait boundaries in Rust testing?

Mocking trait boundaries in Rust testing is best handled using the mockall framework to generate mock implementations, isolate dependencies, and validate interactions without actual implementations.

How do I write parametrized Rust tests for boundary and error cases?

To write parametrized Rust tests for boundary and error cases, use the rstest framework to generate fixtures and parametrized cases that systematically cover happy paths and edge cases within a single function.

Does cargo test work with integration and doc tests for Rust modules?

Cargo test works with integration and doc tests for Rust modules by generating focused unit, integration, and doc tests honoring cargo conventions, requiring clear test intent and dev-dependencies for strict scope control.

Why do my Rust tests fail to compile when adding mockall and rstest dependencies?

Rust tests fail to compile when mockall and rstest are not declared as dev-dependencies; the skill enforces strict scope control by requiring explicit test intent and dev-dependencies before outputting compilable test files and run commands.