test-writing

Write Rust unit, integration, async tokio, and mocking tests.

Updated Apr 8, 2026
One-click install
npx skills add https://github.com/LudwigAJ/swell --skill test-writing-ludwigaj
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-writing
Source: https://github.com/LudwigAJ/swell/tree/main/.swell/skills/test-writing
Command: npx skills add https://github.com/LudwigAJ/swell --skill test-writing-ludwigaj

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill removes the guesswork from creating and improving Rust tests, helping you add coverage quickly while keeping assertions focused on behavior.

Core Features & Use Cases

  • Unit Tests: Write targeted tests for individual functions, modules, and core logic.
  • Async Testing: Build reliable asynchronous tests with tokio for code that depends on tasks, I/O, or timing.
  • Integration and Mocking: Validate public APIs, isolate external dependencies with mocks, and cover both success and failure paths.
  • Use Case: If a Rust module is failing in CI or lacks coverage, use this Skill to produce clear, maintainable tests that protect the behavior you care about.

Quick Start

Use the test-writing skill to add comprehensive Rust tests for the attached module, including unit, async, or integration coverage as needed.

Frequently Asked Questions about test-writing

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

FAQPage Schema
How do I write async Rust tests for tokio tasks and I/O operations?

Async Rust tests apply tokio test attributes to validate code depending on tasks, I/O, or timing. This ensures reliable execution of concurrent behaviors and validates both happy and error paths.

What's the best way to mock external dependencies in Rust integration tests?

Rust integration tests isolate public APIs by mocking external dependencies. This validates both success and failure paths independently, ensuring behavior-focused coverage without relying on live external services.

Can I use proptest to generate property-based tests for my Rust modules?

Yes, proptest generates property-based tests for Rust modules by defining automated inputs to satisfy behavior-focused coverage. This catches edge cases across core logic functions while maintaining descriptive test names.

How do I add unit tests for a Rust module that is failing in CI?

Adding unit tests for a failing Rust module involves writing targeted tests for individual functions. This includes descriptive test names and happy-path and error-path assertions to protect core behavior.

Does this approach to writing Rust tests work for both unit and integration coverage?

Yes, this approach writes comprehensive Rust tests applicable to both unit tests for core logic and integration tests for public APIs. It provides maintainable test structure with clear behavior-focused assertions.

Why do my Rust tests lack maintainability when covering both happy and error paths?

Rust tests lack maintainability without clear structure. Applying behavior-focused coverage with descriptive test names and targeted assertions for both happy-path and error-path conditions resolves this and improves clarity.