STM UNIT - III
STM UNIT - III
All inputs to a program can be considered as if they are numbers. For example, a character
string can be treated as a number by concatenating bits and looking at them as if they were a binary
integer. This is the view in domain testing, which is why this strategy has a mathematical flavor.
Before doing whatever it does, a routine must classify the input and set it moving on the
right path.
An invalid input (e.g., value too big) is just a special processing case called 'reject'.
The input then passses to a hypothetical subroutine rather than on calculations.
In domain testing, we focus on the classification aspect of the routine rather than on the
calculations.
For example, in the statement IF x>0 THEN ALPHA ELSE BETA we know that
numbers greater than zero belong to ALPHA processing domain(s) while zero and
smaller numbers belong to BETA domain(s).
A domain may have one or more boundaries - no matter how many variables define
it.
For example, if the predicate is x2 + y2 < 16, the domain is the inside of a circle of
radius 4 about the origin. Similarly, we could define a spherical domain with one
boundary but in three variables.
Domains are usually defined by many boundary segments and therefore by many
predicates. i.e. the set of interpreted predicates traversed on that path (i.e., the path's
predicate expression) defines the domain's boundaries.
DOMAIN DIMENSIONALITY:
The bug assumption for the domain testing is that processing is okay but the domain
definition is wrong.
An incorrectly implemented domain means that boundaries are wrong, which may
in turn mean that control flow predicates are wrong.
Many different bugs can result in domain errors. Some of them are:
Domain Errors:
Co-incidental Correctness:Domain testing isn't good at finding bugs for which the
outcome is correct for the wrong reasons. If we're plagued by coincidental correctness
we may misjudge an incorrect boundary. Note that this implies weakness for domain
testing when dealing with routines that have binary outcomes (i.e., TRUE/FALSE)
NICE DOMAINS:
Where does these domains come from?
Domains are and will be defined by an imperfect iterative process aimed at achieving (user,
buyer, voter) satisfaction.
Implemented domains can't be incomplete or inconsistent. Every input will be processed
(rejection is a process), possibly forever. Inconsistent domains will be made consistent.
Conversely, specified domains can be incomplete and/or inconsistent. Incomplete in this
context means that there are input vectors for which no path is specified, and inconsistent
means that there are at least two contradictory specifications over the same segment of the
input space.
Some important properties of nice domains are: Linear, Complete, Systematic,
Orthogonal, Consistently closed, Convex and Simply connected.
COMPLETE BOUNDARIES:
Nice domain boundaries are complete in that they span the number space from plus to
minus infinity in all dimensions.
Figure 4.4 shows some incomplete boundaries. Boundaries A and E have gaps.
Such boundaries can come about because the path that hypothetically corresponds to
them is unachievable, because inputs are constrained in such a way that such values
can't exist, because of compound predicates that define a single boundary, or because
redundant predicates convert such boundary values into a null set.
The advantage of complete boundaries is that one set of tests is needed to confirm the
boundary no matter how many domains it bounds.
If the boundary is chopped up and has holes in it, then every segment of that boundary
must be tested for every domain it bounds.
Figure 4.6 shows another desirable domain property: boundary closures are consistent and
systematic.
The shaded areas on the boundary denote that the boundary belongs to the domain in which
the shading lies - e.g., the boundary lines belong to the domains on the right.
Consistent closure means that there is a simple pattern to the closures - for example, using
the same relational operator for all boundaries of a set of parallel boundaries.
CONVEX:
A geometric figure (in any number of dimensions) is convex if you can take two arbitrary
points on any two different boundaries, join them by a line and all points on that line lie
within the figure.
Nice domains are convex; dirty domains aren't.
You can smell a suspected concavity when you see phrases such as: ". . . except if . . .,"
"However . . .," ". . . but not. . . ." In programming, it's often the buts in the specification
that kill you.
Nice domains are simply connected; that is, they are in one piece rather than pieces all over
the place interspersed with other domains.
Simple connectivity is a weaker requirement than convexity; if a domain is convex it is
simply connected, but not vice versa.
Consider domain boundaries defined by a compound predicate of the (boolean) form ABC.
Say that the input space is divided into two domains, one defined by ABC and, therefore,
the other defined by its negation .
For example, suppose we define valid numbers as those lying between 10 and 17 inclusive.
The invalid numbers are the disconnected domain consisting of numbers less than 10 and
greater than 17.
Simple connectivity, especially for default cases, may be impossible.
UGLY DOMAINS:
Some domains are born ugly and some are uglified by bad specifications.
Every simplification of ugly domains by programmers can be either good or bad.
Programmers in search of nice solutions will "simplify" essential complexity out of
existence. Testers in search of brilliant insights will be blind to essential complexity and
therefore miss important cases.
If the ugliness results from bad specifications and the programmer's simplification is
harmless, then the programmer has made ugly good.
But if the domain's complexity is essential (e.g., the income tax code), such
"simplifications" constitute bugs.
Nonlinear boundaries are so rare in ordinary programming that there's no information on
how programmers might "correct" such boundaries if they're essential.
AMBIGUITIES AND CONTRADICTIONS:
Domain ambiguities are holes in the input space.
The holes may lie with in the domains or in cracks between domains.
1. Domains are defined by their boundaries; therefore, domain testing concentrates test points
on or near boundaries.
2. Classify what can go wrong with boundaries, then define a test strategy for each case. Pick
enough points to test for all recognized kinds of boundary errors.
3. Because every boundary serves at least two different domains, test points used to check one
domain can also be used to check adjacent domains. Remove redundant test points.
4. Run the tests and by posttest analysis (the tedious part) determine if any boundaries are
faulty and if so, how.
5. Run enough tests to verify every boundary of every domain.
An interior point (Figure 4.10) is a point in the domain such that all points within an
arbitrarily small distance (called an epsilon neighborhood) are also in the domain.
A boundary point is one such that within an epsilon neighborhood there are points both in
the domain and not in the domain.
An extreme point is a point that does not lie between any two other arbitrary but distinct
points of a (convex) domain.
INTRODUCTION:
Recall that we defined integration testing as testing the correctness of the interface
between two otherwise correct components.
Components A and B have been demonstrated to satisfy their component tests, and
as part of the act of integrating them we want to investigate possible
inconsistencies across their interface.
The set of output values produced by a function is called the range of the function,
in contrast with the domain, which is the set of input values over which the
function is defined.
For most testing, our aim has been to specify input values and to predict and/or
confirm output values that result from those inputs.
Interface testing requires that we select the output values of the calling routine i.e.
caller's range must be compatible with the called routine's domain.
An interface test consists of exploring the correctness of the following mappings:
CLOSURE COMPATIBILITY:
Assume that the caller's range and the called domain spans the same numbers - for
example, 0 to 17.
Figure 4.16 shows the four ways in which the caller's range closure and the called's
domain closure can agree.
The thick line means closed and the thin line means open. Figure 4.16 shows the
four cases consisting of domains that are closed both on top (17) and bottom (0),
open top and closed bottom, closed top and open bottom, and open top and bottom.
For interface testing, bugs are more likely to concern single variables rather than peculiar
combinations of two or more variables.
Test every input variable independently of other input variables to confirm compatibility of
the caller's range and the called routine's domain span and closure of every domain defined
for that variable.
There are two boundaries to test and it's a one-dimensional domain; therefore, it requires
one on and one off point per boundary or a total of two on points and two off points for the
domain - pick the off points appropriate to the closure (COOOOI).
Start with the called routine's domains and generate test points in accordance to the
domain-testing strategy used for that routine in component testing.
Unless you're a mathematical whiz you won't be able to do this without tools for more than
one variable at a time.