maverick-rust-testing

Rust testing patterns (unit, integration, property-based)

⭐0stars🔀0forks📁View on GitHub🕐Updated Jan 7, 2026⬇️2downloads

When & Why to Use This Skill

This Claude skill provides comprehensive patterns and best practices for Rust testing, covering unit tests, integration tests, and advanced property-based testing. It streamlines the creation of robust test suites to ensure code reliability, safety, and performance in Rust applications by automating boilerplate and enforcing rigorous validation standards.

Use Cases

  • Unit Testing: Automatically generate boilerplate for module-level tests using standard Rust macros like #[test], #[cfg(test)], and assert_eq! to validate internal logic.
  • Integration Testing: Structure and implement external tests in the tests/ directory to verify the public API and cross-module functionality of a Rust crate.
  • Property-Based Testing: Leverage proptest and quickcheck patterns to automatically generate diverse input data and discover edge cases that traditional unit tests might miss.
  • Automated Code Review: Audit Rust codebases to identify missing test coverage for new features and enforce severity-based checks for critical logic and edge cases.
  • Error Handling Validation: Implement #[should_panic] tests to ensure that Rust applications handle failure states and panics as expected.
namemaverick-rust-testing
descriptionRust testing patterns (unit, integration, property-based)
version1.0.0

Rust Testing Skill

Unit Tests

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_add() {
        assert_eq!(add(2, 2), 4);
    }

    #[test]
    #[should_panic(expected = "overflow")]
    fn test_overflow() {
        add(i32::MAX, 1);
    }
}

Integration Tests

Place in tests/ directory (separate crate).

Property-Based Testing

use proptest::prelude::*;

proptest! {
    #[test]
    fn test_reverse_involutive(ref vec in prop::collection::vec(any::<i32>(), 0..100)) {
        let reversed_twice: Vec<_> = vec.iter().rev().rev().cloned().collect();
        assert_eq!(vec, &reversed_twice);
    }
}

Review Severity

  • CRITICAL: No tests for new code
  • MAJOR: Missing edge case tests
  • MINOR: Missing documentation on tests