You have designed test cases to provide 100% statement and 100% decision coverage for the following fragment of code.

if width > length
biggest_dimension = width
biggest_dimension = length

The following has been added to the bottom of the code fragment above.

print “Biggest dimension is ” & biggest_dimension
print “Width: ” & width
print “Length: ” & length 

How many more test cases are required?

The options are :

A. One more test case will be required for 100 % decision coverage. B. Two more test cases will be required for 100 % statement coverage, one of which will be used to provide 100% decision coverage. C. None, existing test cases can be used. D. One more test case will be required for 100″ statement coverage.

But according to me D should be correct but the correct answer is C . How is it possible?


enter image description here Considering the given piece of code following cases can given 100% Decision and 100% Statement Coverage.

Case 1

Width = 10
Length = 5

Case 2

Width = 5
Length = 10

Now, you add the three statements to print the result. These will also be covered with the above mentioned cases.

enter image description here

Since there is no new decision added to the script, it would be obvious that new cases wouldn't be required for 100% Decision Coverage.

The 3 print statements added to the script will execute regardless of whether the decision is false or true. Hence the same 2 cases mentioned above will provide 100% statement Coverage. You don't need to add new cases.

  • Thanks a lot :) now it is clear – polina Mar 5 at 10:53
  • can you please tell the tool which you are using for flowcharts design? – polina Mar 5 at 10:57
  • 1
    Im using Draw.io for flowcharts as well as other diagrams. – IAmMilinPatel Mar 5 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.