Watch on Udacity: www.udacity.co... Check out the full Advanced Operating Systems course for free at: www.udacity.co... Georgia Tech online Master's program: www.udacity.co...
Hi, I have a question here, X = 5 in both of the test cases, so why the condition coverage is 100%? Because one of the conditions is that X==0. but X isn't 0 in both test cases .
Hello. Branch coverage is testing which branch in the code is being executed with respect to the test variables that you input it. The conditional statement if ( (x==0) || (y > 0) ), when true, actually forms (and counts as) one branch, and when false, forms another branch. The first test case (x=5 AND y=5) makes the whole condition false. While 2nd test case (x=5 AND y=-5) makes the whole condition evaluate to false. Thus all branches were executed and covered. Hope that helps!
This was an excellent tutorial, but I am a little lost on the True/False statement as it is illustrated on your CFG. It goes 3 > 4 > Then Jumps into an If/Else statement. Why is the If/Else statement not being carried out on 5 as your test suggests? I have just stumbled across this stuff and trying to work out the differences between Statement/Branch.
I think there is an error on the diagram. The decision circle, if ((x==0) || (y>0)), should be labelled 5 and there should be an additional circle 4, signifying 'read (y)', between circles 3 and 5. Great explanatory tutorial nonetheless.