I am really confuse with the statement coverage. I did some search on the Internet. Some say the statement coverage only go through the true condition, which in this case is 1-2-3-4-12. However, others say the statement coverage should cover as many statements as possible, which I believe in this case will be 1-2-3-5-6-7-8-9-10-11-12. Which one is correct?
For the branch coverage, I believe I should test both the true/false conditions without considering the loop, which I will use the value 1)x=-1 and 2)x=0
For the path coverage, I think I should test all the paths so compared to branch coverage I will need to test the loop also. So I am going to use the value 1) x= -1, 2)x = 0 and 3) x = 10.
Is my answers correct?
Thank you in advance
To calculate Statement Coverage, find out the shortest number of paths following which all the nodes will be covered.
So in your case : 1-2-3-5-6-7-8-9-10-11-12 This path is the shortest and covering maximum number of nodes but not all
so we have to take one more path , which is : 1-2-3-4-12
So in this exercise , the value of SC=2