Mutation Testing - CI/CD用語集の定義
mutation testingは、意図的に小さなバグを注入し、テストがそれを捕まえるかを確認します。生き残ったmutantは、実行されてはいるが実際には検証されていないコードを明らかにします。
mutation testingは、コードに小さな変更(mutant)を導入してテストが失敗するかを確認することで、テストスイートの品質を測ります。テストがなお通ってしまうmutantは「survived(生存)」であり、テストのギャップを示します。
mutation scoreは行カバレッジを補完します。行カバレッジはアサーションが弱くても高くなり得るからです。
score vs カバレッジ
行カバレッジはコードが実行されたことを示し、mutation scoreはそのコードのバグが捕まえられることを示します。テストのアサーションが乏しければ、ファイルはカバレッジが満点でもmutation scoreが低いことがあります。
CIでの位置づけ
mutationの完全な実行は高コストなため、チームはpull request毎に変更されたファイルだけをmutateし、完全な分析はスケジュールで実行することがよくあります。
関連ガイド
Test Impact Analysis - CI/CD Glossary DefinitionTest Impact Analysis: Test impact analysis (TIA) selects the subset of tests affected by a code change, using…
Coverage Ratchet - CI/CD Glossary DefinitionCoverage Ratchet: A coverage ratchet is a CI policy that fails a change if it lowers test coverage below the…
Flaky Test Quarantine - CI/CD Glossary DefinitionFlaky Test Quarantine: Flaky test quarantine moves known-flaky tests into a non-blocking bucket so their inte…