I am preparing myself for ISTQB exam and i came across this question.
7. For the code fragment given below, which answer correctly represents
minimum tests
required for statement and branch coverage respectively?
Discount rate=1;
Fare = 1000;
If ((person == “senior citizen”) and (“travel month = January”))
Bonuspoints = 100+Bonuspoints
If (class==”first”)
discountRate = .5;
Fare = fare * discountRate;
a. Statement Coverage = 1, Branch Coverage = 2
b. Statement Coverage = 2, Branch Coverage = 2
c. Statement Coverage = 1, Branch Coverage = 3
d. Statement Coverage = 2, Branch Coverage = 4
Answer is A
But my answer is C the reason is flowchart i draw for it given below.
-
Straight forward from start to end
-
One false for 1st 'if'
-
second false for 2nd 'if'
My question is:
- Should we draw an edge 'explicitly' for 'false' condition, if it is not given in question itself.
- How branch coverage is 3 here ?
Aucun commentaire:
Enregistrer un commentaire