rust-testing

Write, review, and refactor Rust tests with cargo test, mockall, and tokio.

193|17|Updated Jan 16, 2026
One-click install
npx skills add https://github.com/pproenca/dot-skills --skill rust-testing-pproenca
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-testing
Source: https://github.com/pproenca/dot-skills/tree/main/skills/.experimental/rust-testing
Command: npx skills add https://github.com/pproenca/dot-skills --skill rust-testing-pproenca

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

This Skill provides a comprehensive methodology for writing, reviewing, and refactoring Rust tests, ensuring code reliability and maintainability.

Core Features & Use Cases

  • Test Organization: Best practices for structuring unit and integration tests.
  • Mocking Strategies: Guidelines for effective mocking with mockall and trait-based design.
  • Async Testing: Patterns for testing asynchronous Rust code using Tokio.
  • Use Case: When developing a new Rust library, use this Skill to ensure all code paths are covered by well-structured, maintainable tests, including complex asynchronous operations and external dependencies.

Quick Start

Apply the rust-testing skill to refactor the current test suite for improved organization and mocking.

Frequently Asked Questions about rust-testing

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

FAQPage Schema
How do I structure Rust unit and integration tests for better maintainability?

To structure Rust unit and integration tests effectively, place unit tests within a `mod tests` block in your source files, and isolate integration tests in the `tests/` directory. This separation ensures code reliability and maintainability through deterministic and comprehensive test suites.

What is the best way to mock dependencies in Rust async testing?

The best way to mock dependencies in Rust async testing is using the `mockall` crate combined with trait-based design. This pattern allows you to generate mock implementations for traits, ensuring deterministic testing of asynchronous Rust code using Tokio.

How do I test asynchronous Rust code using Tokio?

To test asynchronous Rust code using Tokio, apply the `#[tokio::test]` macro to your test functions. This pattern provides the necessary async runtime environment, allowing you to write deterministic and comprehensive test suites for complex asynchronous operations.

Can I use `cargo test` with `assert_cmd` for Rust integration tests?

Yes, you can use `cargo test` with `assert_cmd` for Rust integration tests. `assert_cmd` allows you to execute binary crates and assert on command-line output, ensuring code reliability and maintainability for external dependencies within your test suites.

Does Rust support property-based testing for comprehensive test suites?

Rust supports property-based testing to ensure code reliability and maintainability through comprehensive test suites. This methodology provides best practices for writing and refactoring tests, challenging your code with automatically generated inputs to cover all code paths.

Why are my Rust async tests non-deterministic when mocking external dependencies?

Rust async tests become non-deterministic when mocking external dependencies without proper trait boundaries or runtime handling. Refactoring test suites with `mockall` and `tokio` patterns addresses these challenges, ensuring deterministic and comprehensive test suites.