22.11.2012 Views

Schaum's Outline Series

Schaum's Outline Series

Schaum's Outline Series

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

150<br />

By the fourth test case, every statement has been executed. This set of test cases<br />

is not the smallest set that would cover every statement. However, finding the<br />

smallest test set would often not find a good test set.<br />

10.3.4.2 C1—Every-Branch Testing<br />

A more thorough test criterion is every-branchtesting, which is often called C1 test<br />

coverage. In this criterion, the goal is to go both ways out of every decision.<br />

EXAMPLE 10.4<br />

If we model the program of Example 10.3 as a control flow graph (see Chapter 2),<br />

this coverage criterion requires covering every arc in the control flow diagram. See<br />

Fig. 10-1.<br />

A,B,C<br />

E<br />

G<br />

I<br />

K<br />

Fig. 10-1. Control flow graph for<br />

Example 10.3.<br />

10.3.4.3 Every-Path Testing<br />

D<br />

F<br />

H<br />

J<br />

CHAPTER 10 Software Testing<br />

Arcs 3,4,5 3,5,3 0,1,0 4,4,4<br />

ABC–D * * *<br />

ABC–E*<br />

D–E* * *<br />

E–F *<br />

E–G * * *<br />

F–G *<br />

G–H *<br />

G–I * * *<br />

H–I *<br />

I–J *<br />

I–K * * *<br />

J–K *<br />

Even more thorough is the every-pathtesting criterion. A path is a unique sequence<br />

of program nodes that are executed by a test case. In the testing matrix (Example<br />

10.2) above, there were eight subdomains. Each of these just happens to be a path.<br />

In that example, there are sixteen different combinations of T and F. However,<br />

eight of those combinations are infeasible paths. That is, there is no test case that

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!