概要
テストフレームワーク (Testing Framework) はソフトウェアの自動テストコードを実行・管理する基盤ソフト。1989年 Kent Beck の SUnit (Smalltalk) を起点に、JUnit (1997, Java)、unittest (2001, Python)、QUnit (2008, JS)、Mocha (2011)、Jasmine (2010)、Jest (2014)、Vitest (2021) と発展してきた。E2E (End-to-End) 領域は Selenium (2004)、Cypress (2017)、Playwright (2020) が主要選択肢。
2025-2026年の JavaScript エコシステムは Vitest 4 が新興本命。Vite ベースで Jest 比 2-5倍高速、ESM ネイティブ対応、TypeScript 標準対応で、新規プロジェクトの 65% が Vitest 採用 (State of JS 2025)。E2E 領域は Playwright 1.59 が Cypress を逆転、マルチブラウザ (Chromium/Firefox/WebKit) 対応・並列実行・AI 機能 (Codegen Pilot) で優位。
各言語の主要選択肢: Python = pytest 8 (シェア 78%), Java = JUnit 5 + Mockito, Go = 標準 testing + testify, Rust = 標準 cargo test + tokio-test, C# = xUnit/NUnit, Ruby = RSpec/Minitest, PHP = PHPUnit/Pest。CI/CD 統合では GitHub Actions が64%、GitLab CI 18%、CircleCI 9%、Jenkins 9% が2026年4月時点のシェア。
主な特徴・仕組み
- テスト種別: Unit (関数単位) / Integration (モジュール結合) / E2E (実ブラウザ) / Visual Regression / Performance / Mutation
- JS 主要 2026: Vitest 4 (Unit), Playwright 1.59 (E2E), Cypress 13 (E2E), Jest 30 (Unit/Legacy), Storybook 9 + interactions
- Python 主要 2026: pytest 8 + pytest-asyncio + pytest-benchmark, unittest (標準ライブラリ)
- Java 主要 2026: JUnit 5 + Mockito + AssertJ, TestNG, Spock (Groovy)
- モック手法: Sinon (JS), Mockito (Java), MagicMock (Python), gomock (Go)
- アサーション: expect/should/assert スタイル、Jest/Vitest は expect、pytest は assert
- カバレッジ: Istanbul (JS), Coverage.py (Python), JaCoCo (Java)、80%以上が業界目標
- 並列実行: Vitest 4 = 2-3倍高速 (Worker Threads)、Playwright = ブラウザ並列、pytest-xdist
- AI 機能 2026: Playwright Codegen Pilot (テスト自動生成)、Cursor + Vitest (テストファースト開発)
- CI 連携: GitHub Actions matrix で OS×Node.js バージョン並列実行、合計 30-50秒 → 5-15秒に短縮
主要テストフレームワーク比較表(2026年4月)