skillfed

testing-strategy

Testing Strategy provides comprehensive testing patterns for Tauri applications spanning Rust backend and React frontend. It covers unit and integration tests, test fixtures, command mocking, and test coverage strategies to support quality assurance and TDD workflows.

Testing Strategy helps you write and structure unit tests for Rust backend and React frontend code.

AI-generated summary based on this skill's SKILL.md

4 3 MIT updated by cacr92

Install

cacr92/WeReply/testing-strategy · repository language: Python

git clone https://github.com/cacr92/WeReply
cp -r WeReply/.claude/skills/testing-strategy ~/.claude/skills/testing-strategy
npx skillfed install cacr92/WeReply/testing-strategy

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I write Rust unit tests for backend code?

Testing Strategy recommends structuring Rust unit tests within your backend modules using `#[cfg(test)]` modules and the `#[test]` attribute. For async code, use `#[tokio::test]` to run tests with the Tokio runtime. Keep tests focused on single behaviors, use descriptive names, and leverage assertions like `assert_eq!` and `assert!`. Testing Strategy emphasizes organizing tests close to the code they verify for maintainability.

What's the best approach for react component testing with vitest?

Testing Strategy guides you through React component testing by rendering components with a testing library, then querying and asserting on DOM elements. Use vitest as your test runner for fast feedback. Mock external dependencies and API calls to isolate component logic. For hooks, Testing Strategy recommends using `renderHook` to test custom logic independently, and pair it with `waitFor` for async state updates.

How should I set up test fixtures and database seeding for integration tests?

Testing Strategy advises creating reusable test fixtures that populate your database with consistent test data before each test run. For SQLite, use in-memory databases to avoid file I/O overhead. Define fixture factories that generate realistic data shapes, then seed them in setup hooks. Testing Strategy emphasizes isolating test data so tests remain independent and can run in any order without side effects.

How do I implement TDD workflow and improve test coverage?

Testing Strategy supports the red-green-refactor cycle: write a failing test first, implement minimal code to pass it, then refactor. Track coverage with tools like tarpaulin for Rust and vitest's coverage reports for TypeScript. Testing Strategy recommends setting coverage goals (e.g., 80%) and focusing on critical paths rather than chasing 100%. Regularly review uncovered branches to identify gaps.

What's the tauri command mocking setup for testing?

Testing Strategy explains that Tauri commands can be mocked by stubbing the invoke function in your test environment. Create mock implementations that return predictable responses, allowing you to test frontend logic without running the backend. Testing Strategy suggests using vitest's `vi.mock()` to intercept command calls and inject test data, enabling isolated component testing.

How do I test my API calls and external dependencies?

Testing Strategy recommends mocking external dependencies using your test framework's mocking utilities. For API calls, intercept HTTP requests with libraries like MSW (Mock Service Worker) or stub fetch/axios directly. Testing Strategy emphasizes testing both success and error paths, validating request payloads, and ensuring your code handles timeouts and network failures gracefully.

SKILL.md

rendered from the published skill — quoted content, verbatim

Testing Strategy Skill

Comprehensive testing guidance for Tauri applications with Rust backend and React frontend.

Overview

This skill provides testing strategies for: - Rust unit and integration tests - React component and hook tests - Tauri command mocking - Database testing with fixtures - Test coverage and quality gates - TDD (Test-Driven Development) workflows

When This Skill Applies

This skill activates when: - Writing new tests for Rust or TypeScript code - Implementing test doubles and mocks - Setting up test infrastructure - Debugging test failures - Improving test coverage - Planning testing strategy for features

Rust Testing

Unit Tests

Location: In the same module as the code being tested

```rust

[cfg(test)]

mod tests { use super::*;

#[test]
fn test_formula_cost_calculation() {
    let materials = vec![
        FormulaMaterial {
            material_code: "corn".to_string(),

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 2 files
.claude/skills/testing-strategy/SKILL.md
.claude/skills/testing-strategy/skill.json

Related skills

Tags

backend-testing frontend-testing quality-assurance test-infrastructure mock-doubles coverage-metrics async-testing end-to-end-workflows test-data-setup validation-testing