Home Basic SDP Test Case Web Testing FAQ Others
You are here: Home>>Test Plan & Test Case>> Test Case Design - Page 3

Sample Test Plan

you are hereQA Test Case Design


We need your help! To keep the site alive, please make the donation by clicking the button below.
Thank you very much!

How to Make a Donation Using PayPal Without an Account?
Pages: Prev 1 2 3 4 5 6 7 8 9 10 11 12 Next

Software Test Case Design

Software Testing - Software Test Case Design - Page 3

Since we have deemed statement coverage to be a necessary condition, decision coverage, a seemingly better criterion, should be defined to include statement coverage. Hence, decision coverage requires that each decision have a true and a false outcome, and that each statement be executed at least once. An alternative and easier way of expressing it is that each decision has a true and a false outcome, and that each point of entry (including ON-units) be invoked at least once.

This discussion considers only two-way decisions or branches and has to be modified for programs that contain multiway decisions. Examples are Java programs containing select (case) statements, FORTRAN programs containing arithmetic (three-way) IF statements or computed or arithmetic GOTO statements, and COBOL programs containing altered GOTO statements or GO-TO-DEPENDING-ON statements. For such programs, the criterion is exercising each possible outcome of all decisions at least once and invoking each point of entry to the program or subroutine at least once.

In Figure 1 on page 2, decision coverage can be met by two test cases covering paths ace and abd or, alternatively, acd and abe. If we choose the latter alternative, the two test-case inputs are A = 3, B = 0, X = 3 and A = 2, B = 1, and X = 1.

Decision coverage is a stronger criterion than statement coverage, but it still is rather weak. For instance, there is only a 50 percent chance that we would explore the path where X is not changed (i.e., only if we chose the former alternative). If the second decision were in error (if it should have said X<1 instead of X>1), the mistake would not be detected by the two test cases in the previous example.

A criterion that is sometimes stronger than decision coverage is condition coverage. In this case, you write enough test cases to ensure that each condition in a decision takes on all possible outcomes at least once. Since, as with decision coverage, this does not always lead to the execution of each statement, an addition to the criterion is that each point of entry to the program or subroutine, as well as ONunits, be invoked at least once. For instance, the branching statement

DO K=0 to 50 WHILE (J+K<QUEST)

contains two conditions: is K less than or equal to 50, and is J+K less than QUEST? Hence, test cases would be required for the situations K<=50, K>50 (to reach the last iteration of the loop), J+K<QUEST, and J+K >=QUEST.

Figure 1 on page 2 has four conditions: A>1, B=0, A=2, and X>1. Hence, enough test cases are needed to force the situations where A>1, A<=1, B=0, and B<>0 are present at point a and where A=2, A<>2, X>1, and X<=1 are present at point b. A sufficient number of test cases satisfying the criterion, and the paths traversed by each, are

  1. A=2, B=0, X=4 ace
  2. A=1, B=1, X=1 adb
 

Page 3


Pages: Prev 1 2 3 4 5 6 7 8 9 10 11 12 Next