アサーション (Assertion) - CI/CD用語集の定義
assertion は、テスト対象のコードが期待される結果を生んだかどうかを検証します。失敗した assertion はテストを失敗させます。
アサーション (Assertion) は、値または条件が期待どおりかどうかを確認するテスト内の文です。それが失敗すると、テストが失敗します。
assertion は、テストの中で実際に振る舞いを検証する部分です。意味のある assertion のないテストはコードを実行しますが何も証明しません。だからこそミューテーションテストは弱い assertions を狙います。
例
一般的な形式には assertEqual(a, b)、expect(x).toBe(y)、assert result == 42 があります。広い真偽チェックよりも、具体的な assertions を優先してください。
関連ガイド
Test Case - CI/CD Glossary DefinitionTest Case: A test case is a single scenario with defined inputs, actions, and expected outcomes that verifies…
Mutation Score - CI/CD Glossary DefinitionMutation Score: Mutation score is the percentage of introduced mutants that the test suite detected (killed)…
Arrange, Act, Assert - CI/CD Glossary DefinitionArrange, Act, Assert: Arrange, Act, Assert (AAA) is a pattern for structuring a test into three clear phases:…