Software-testing-dictionary-branch-testing

提供:Dev Guides
移動先:案内検索

ブランチテスト

ブランチテストとは

ブランチカバレッジは、各決定ポイントからの可能なブランチのそれぞれが少なくとも1回実行されることを保証するテスト方法であり、それにより、到達可能なすべてのコードが実行されることを保証します。

つまり、すべての分岐は、真と偽のそれぞれの方法で行われます。 コード内のすべてのブランチを検証して、アプリケーションの異常な動作につながるブランチがないことを確認するのに役立ちます。

式:

Branch Testing = (Number of decisions outcomes tested/Total Number of decision Outcomes) x 100 %

例:

Read A
Read B
IF A+B > 10 THEN
  Print "A+B is Large"
ENDIF
If A > 5 THEN
  Print "A Large"
ENDIF

上記のロジックは、フローチャートで次のように表すことができます。

テストライフサイクルでのブランチテスト

結果:

To calculate Branch  Coverage, one has to find out the minimum number of paths which will ensure that all the edges are covered. In this case there is no single path which will ensure coverage of  all the edges at once. The aim is to cover all possible true/false decisions.
(1) 1A-2C-3D-E-4G-5H
(2) 1A-2B-E-4F
Hence Branch Coverage is 2.