d-o-hub

test-runner

4
0
# Install this skill:
npx skills add d-o-hub/rust-self-learning-memory --skill "test-runner"

Install specific skill from multi-skill repository

# Description

Execute and manage Rust tests including unit tests, integration tests, and doc tests. Use when running tests to ensure code quality and correctness.

# SKILL.md


name: test-runner
description: Execute and manage Rust tests including unit tests, integration tests, and doc tests. Use when running tests to ensure code quality and correctness.


Test Runner

Execute and manage Rust tests for the self-learning memory project.

Test Categories

Category Command Scope
Unit cargo test --lib Individual functions
Integration cargo test --test '*' End-to-end workflows
Doc cargo test --doc Documentation examples
All cargo test --all Complete validation

Execution Strategy

Step 1: Quick Check (Unit Tests)

cargo test --lib
  • Fast feedback (< 30s)
  • Catch basic logic errors

Step 2: Integration Tests

cargo test --test '*'
  • Tests database interactions
  • Requires Turso/redb setup

Step 3: Full Suite

cargo test --all
  • Complete validation before commit

Troubleshooting

Async/Await Issues

Symptom: Test hangs

#[tokio::test]
async fn test_async() {
    let result = async_fn().await;  // Don't forget .await
}

Database Connection

Symptom: Connection refused
- Check TURSO_URL, TURSO_TOKEN
- Use test database

Race Conditions

Symptom: Intermittent failures

cargo test -- --test-threads=1

redb Lock Errors

Symptom: "Database is locked"
- Use separate DB per test
- Close transactions promptly

Coverage

cargo install cargo-llvm-cov
cargo llvm-cov --html --output-dir coverage

Best Practices

  • Isolation: Each test independent
  • Cleanup: Remove test data
  • Speed: < 1s per unit test
  • Naming: Describe behavior

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.