Is block coverage the same as branch coverage, similar to it or completely different?
The top Google link explaining branch coverage: http://www.tutorialspoint.com/software_testing_dictionary/branch_testing.htm
Block coverage (or "basic block coverage") and branch coverage are two different measures of code coverage. Block coverage counts blocks bounded by branches. Branch coverage counts the actual branches.
This code fragment
puts "I'm block 1"
if condition
puts "I'm block 2"
else
puts "I'm block 3"
end
puts "I'm block 4"
has four blocks but only two branches, the two sides of the if
/else
. If this code is tested by only one test and condition
is true in that test,
if
will be covered but not the false branch of the if
, so branch coverage will be 50%If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With