qe-test-execution について
v3 のテスト実行機能を活用するためのガイドです。テストスイートの実行時間短縮や CI/CD テストパイプラインの構築に向け、並列実行、変更対象のテスト選択、不安定なテストへの対処、分散実行を扱います。
主な機能
- 01テストスイートの並列実行
- 02変更の影響を受けるテストの選択
- 03不安定なテストの再試行と処理
- 04環境間でのテスト分割実行
- 05実行結果の集約
活用シーン
- 01大規模テストスイートの実行時間短縮
- 02コード変更に関係するテストのみ実行
- 03不安定なテストの診断と管理
- 04CI/CD テストパイプラインの構築
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ proffesor-for-testing/ agentic-qe --skill qe-test-executionインストール後、Claude Code で/qe-test-executionを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
evals/qe-test-execution.yamlschemas/output.jsonscripts/validate-config.json詳細
QE テスト実行
目的
並列オーケストレーション、スマートなテスト選択、不安定なテストへの対応、複数環境にまたがる分散実行など、v3 のテスト実行機能の使用方法を説明します。
有効化するタイミング
- テストスイートを実行するとき
- テストの実行時間を最適化するとき
- 不安定なテストに対処するとき
- CI/CD テストパイプラインを設定するとき
- 複数の環境でテストを実行するとき
クイックスタート
# Run all tests with parallelization
aqe test run --parallel --workers 4
# Run affected tests only
aqe test run --affected --since HEAD~1
# Run with retry for flaky tests
aqe test run --retry 3 --retry-delay 1000
# Run specific test types
aqe test run --type unit,integration --exclude e2e
エージェントのワークフロー
// Orchestrate test execution
Task("Execute test suite", `
Run the full test suite with:
- 4 parallel workers
- Retry flaky tests up to 3 times
- Generate JUnit report
- Fail fast on critical tests
Report results and any failures.
`, "qe-test-executor")
// Smart test selection
Task("Run affected tests", `
Analyze changes in PR #123 and:
- Identify affected test files
- Run only relevant tests
- Include integration tests for changed modules
- Report coverage delta
`, "qe-test-selector")
実行戦略
1. 並列実行
await testExecutor.runParallel({
suites: ['unit', 'integration'],
workers: 4,
distribution: 'by-file', // or 'by-test', 'by-duration'
isolation: 'process',
sharding: {
enabled: true,
total: 4,
index: process.env.SHARD_INDEX
}
});
2. スマートなテスト選択
await testExecutor.runAffected({
changes: gitChanges,
selection: {
direct: true, // Tests for changed files
transitive: true, // Tests for dependents
integration: true // Integration tests touching changed code
},
fallback: 'full-suite' // If analysis fails
});
3. 不安定なテストへの対応
await testExecutor.handleFlaky({
detection: {
enabled: true,
threshold: 0.1, // 10% flake rate
window: 100 // Last 100 runs
},
strategy: {
retry: 3,
quarantine: true,
notify: ['#flaky-tests']
}
});
実行設定
execution:
parallel:
workers: auto # CPU cores - 1
timeout: 30000
bail: false
retry:
count: 2
delay: 1000
only_failed: true
reporting:
formats: [junit, json, html]
include_timing: true
include_logs: true
environments:
- name: node-18
image: node:18-alpine
- name: node-20
image: node:20-alpine
CI/CD との統合
# GitHub Actions example
test:
runs-on: ubuntu-latest
strategy:
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v4
- name: Run tests
run: |
aqe test run \
--shard ${{ matrix.shard }}/4 \
--parallel \
--report junit
- name: Upload results
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.shard }}
path: reports/
結果の集約
interface ExecutionResults {
summary: {
total: number;
passed: number;
failed: number;
skipped: number;
flaky: number;
duration: number;
};
shards: ShardResult[];
failures: TestFailure[];
flakyTests: FlakyTest[];
coverage: CoverageReport;
timing: TimingAnalysis;
}
注意点
- コンテナー内では、テストスイート全体の実行で OOM が発生する場合があります。
CLAUDE.mdに「スイート全体を実行しない」というルールがあったにもかかわらず、20 回違反されました。対策:ルールを追加するだけではなく、スイートを軽量化してください。 - 焦点を絞ったエージェントは少数(3~4 個)のほうが、曖昧なエージェントを多数(6~8 個)使うより効果的です。各エージェントのプロンプトには、必ず検証コマンドを含めてください。
- 新しいモデルのリリースにより、スプリントの途中でエージェントの動作が変わることがあります。モデルの更新後、昨日まで従っていたルールが今日は無視される場合があります。
- すべてのテストを並列実行すると、不安定なテストが見えにくくなる場合があります。初期診断では
--workers=1を使用してください。 - セッションがクラッシュすると、すべてのコンテキストが失われます。中間結果はメモリだけでなく、ディスクにも保存してください。
連携
主なエージェント:qe-test-executor、qe-test-selector、qe-flaky-detector コーディネーター:qe-test-execution-coordinator 関連スキル:qe-test-generation、qe-coverage-analysis
コメント
Markdown 対応