mcpField
T
test-runner

test-runner

github.com/d-o-hubテスト・品質1336 回インストール今日更新
リポジトリ

test-runner について

自己学習型メモリープロジェクトで Rust のテストを実行、管理するスキルです。テスト分類、非同期テスト、カバレッジ、一般的な障害の調査を扱います。

主な機能

  1. 01ユニット、統合、ドキュメントテスト
  2. 02ミューテーションテストのコマンド
  3. 03非同期テストのパターン
  4. 04テスト分離の実践方法
  5. 05カバレッジ生成と障害対応

活用シーン

  1. 01種類を選んで Rust テストを実行
  2. 02非同期コードやタイムアウトのテスト
  3. 03競合状態やデータベースロックの調査
  4. 04HTML カバレッジレポートの生成

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/d-o-hub/rust-self-learning-memory --skill test-runner

インストール後、Claude Code で/test-runnerを入力して読み込まれたか確認します。

同梱ファイルevals/evals.json

詳細

テストランナー

自己学習型メモリプロジェクトの Rust テストを実行および管理します。

コマンド

# Unit tests (fast, <30s)
cargo nextest run --lib

# Integration tests
cargo nextest run --test '*'

# Full suite
cargo nextest run --all
cargo test --doc  # doctests (nextest unsupported)

# Quality gates (coverage threshold 90%)
./scripts/quality-gates.sh

テストカテゴリ

カテゴリコマンド対象範囲
単体cargo nextest run --lib個々の関数
統合cargo nextest run --test '*'エンドツーエンドのワークフロー
ドキュメントcargo test --docドキュメントの例
ミューテーションcargo mutants -p do-memory-coreテストの有効性

ベストプラクティス

  • 分離:各テストを独立させます
  • AAA パターン:準備・実行・検証
  • 単一責任:テストごとに 1 つの振る舞いを対象にします
  • 命名:test_<function>_<scenario>_<expected>
  • 速度:単体テスト 1 件あたり <1s

非同期テスト

#[tokio::test]
async fn test_episode() { let result = async_fn().await; }

#[tokio::test(start_paused = true)]
async fn test_timeout() { /* paused clock */ }

#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn test_concurrent() { /* parallel ops */ }
悪い例良い例
std::thread::sleep()tokio::time::sleep().await
.await がない非同期処理は必ず await します

トラブルシューティング

問題解決方法
競合状態cargo test -- --test-threads=1
redb のロックエラーテストごとに DB を分けます
DB 接続拒否TURSO_URL/TURSO_TOKEN を確認します

カバレッジ

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

参考資料

  • ADR-033:最新のテスト戦略

関連スキル:テスト設計には test-patterns、パフォーマンスを重視したテスト作業には test-optimization、失敗するテストスイートの原因診断には test-fix を使用します。

コメント