Minimum number of testcase required for 100% statement coverage

If the pseudocode below were a programming language ,how many tests are
required to achieve 100% statement coverage?
1. If x=3 then
2. Display_messageX;
3. If y=2 then
4. Display_messageY;
5. Else
6. Display_messageZ;
7. Else
8. Display_messageZ;

According to me the answer should be 2 testcases

please assist with the correct answer

sandeep123 Default Asked on December 22, 2014 in Software Testing.
Add Comment
1 Answer(s)

Well, you have  the same result for Else condition for the second If, I would say that last Else Display_messageZ is unecessary  and step 7 and 8 should be ignored.  for Step 1 should be two test cases for when x value is 3 and when is not 3. For step 3, should be 1 test case for when y is 2 and another test case for when is different than  two and should Display_messageZ. I would go with 4 Test cases to test this functionality.

Juliow Train Answered on December 22, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.