Statement Coverage Vs. Branch Coverage

Written by micah mcdunnigan
  • Share
  • Tweet
  • Share
  • Pin
  • Email
Statement Coverage Vs. Branch Coverage
Statement and branch coverage are methods of testing source code. (code image by Charles Taylor from

The source code for computer programs uses a series of If statements to call specific code blocks if certain conditions are met. Statement and branch coverage are methods for testing the functioning of the If statements in a given source code.


The code block associated with a given If statement executes when a variable equals a certain value when that If statement is reached in the program's execution. Statement and branch coverage test If statements by feeding every possible input into the source code. They then examine the values of the conditional variables and the behaviour of the If statements.

Statement Coverage

Statement coverage tests source code by examining if every If statement will be activated by at least one possible inputs a program could receive. This is also called line coverage, segment coverage and basic block coverage.

Branch Coverage

In programming, a boolean variable is one which has a value of True or False. This type of variable is often used to activate an If statement. Branch coverage tests source code under every possible iteration of the code to make sure that every boolean value could end up as either True or False.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.