10.12.2012 Views

Domain Testing: Divide and Conquer - Testing Education

Domain Testing: Divide and Conquer - Testing Education

Domain Testing: Divide and Conquer - Testing Education

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

To assert that the output value Z assumes the correct value for all input values of<br />

X <strong>and</strong> Y, we have to test all possible assignment values of X <strong>and</strong> Y. Assume that<br />

X <strong>and</strong> Y take integer values.<br />

If the program is being tested on a computer for which the word size is 32 bits<br />

then the total possible values for X <strong>and</strong> Y, each are 2 32 .Since the combination of<br />

X <strong>and</strong> Y yields Z, we have to test X <strong>and</strong> Y in combination.<br />

The total possible combinations for X <strong>and</strong> Y are 2 32 x 2 32<br />

Now, if we assume that the program takes about a millisecond to execute once,<br />

we will need more than 50 billion years to completely test this program!<br />

If testing a program as simple as this can lead to combinatorial explosion <strong>and</strong><br />

make testing seem impossible, imagine what happens with huge complicated<br />

programs having hundreds of variables? This is where domain testing comes to<br />

our rescue by helping us systematically reduce an infinitely large input domain to<br />

few manageable sub-domains <strong>and</strong> then helping us choose the best test cases from<br />

each sub-domain, thereby reducing out testing effort (time, money, labor, etc…)<br />

drastically.<br />

Step 7: Apply boundary value analysis, wherever applicable, to pick best test cases<br />

from each sub-domain.<br />

Rather than selecting any arbitrary element in an equivalence class as being the best<br />

representative, the boundary-value analysis requires that one or more elements be<br />

selected such that each edge (border) of the equivalence class is the subject of a test.<br />

Hence, values on the boundary <strong>and</strong> values just off the boundary (below <strong>and</strong>/or beyond,<br />

whatever is applicable) are selected in an equivalence class to be the best representatives<br />

or test cases for that equivalence class.<br />

What are the pitfalls of boundary-value analysis?<br />

• Boundary-value analysis works well only when the program to be tested is<br />

a function of several independent variables that represent bounded<br />

physical quantities. In other words, boundary value analysis does not find<br />

© Sowmya Padmanabhan, 2003<br />

4

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

Saved successfully!

Ooh no, something went wrong!