0% found this document useful (0 votes)
36 views18 pages

Testing KK

The document discusses testing techniques for programs, including boundary value analysis and worst case testing. Boundary value testing involves testing boundary values of inputs, such as minimums, maximums, and values just inside/outside boundaries. For a program testing numbers from 1-100, there would be 4+1=5 test cases for each boundary value, and 25 total test cases. Worst case testing selects test cases that are most likely to reveal errors based on extreme values and logical conditions. The document provides an example of designing test cases for a program that determines the nature of roots of a quadratic equation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views18 pages

Testing KK

The document discusses testing techniques for programs, including boundary value analysis and worst case testing. Boundary value testing involves testing boundary values of inputs, such as minimums, maximums, and values just inside/outside boundaries. For a program testing numbers from 1-100, there would be 4+1=5 test cases for each boundary value, and 25 total test cases. Worst case testing selects test cases that are most likely to reveal errors based on extreme values and logical conditions. The document provides an example of designing test cases for a program that determines the nature of roots of a quadratic equation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

utlon

.._____
Aa wa know, robuat tut c:aaee are 6n + J
caaet1
,.... __
are 19
u given below:
0
.
1 - 1
t I NJ5tT mad ...y lib t.o eee what happens
- - . ha elec:tauaic circuits analysis, this is -2 I 0
3
i...- at ill tM - that boundary value test cases
......_ _.. eftbrt. Worst case testing for a 4 50
• appaaed t.o 4n + 1 test cases for boundary 5 99
will haw 5 1 = 25 test cases and are given in
6 100
7 101
,.,.,,.,. 8
9
50
50
:,
"
200 299
10 50
14
11 50
300
-IOI 15
16
200
299 100
12 50
-IOO
-
13 50
IOI
-299 17
18
299
200
14 50
299
- 15 50
-He 19 299 299
16 50
-101 20 299 300
--
17 50
-IOO 21 300 100
-
18 50
22 300
I
-..- ..
IOI
- 19 50
23 300 200
11 1 18 24 300 299
u 101 25 300 300
L1
D I y ,,.._ ....,_ . . . . 1NII for the programa with independent input values.
a..illpatwalwahaaW .. tnlJr" I z f t Tbiatechniquedoeanotmakesenseforboolean 0
- i ti when eztreme .......,_. 'lmJB and FALSE, but no choice is available for
clear
.._..,..._lib acwninel fl
jaat - - - • dad below boundary.
J just
0
0
T a" M 5 0
die pnc1am for the. detea · tien ol nature of roots of a quadratic equation a s
ill Bumple 8.1. Design the...._ t.aat caw and WOl'llt teat caaes for this program
6 0
...
.:.Ii 101 50
I 50 50 50
I 50 0 60
I 50 101 50

7 -I 50
50
50
50
50
0
8 50 50 101 Invalid input
9 50 50 50 Equilateral
10 60 60 60 Equilateral
11 50 50 60 Isosceles
12 50 60 50 Isosceles
13 60 50 50 Isosceles
14 100 99 50 Scalene
15 100 50 50 Not a triangle
16 100 50 25 Not a triangle
17 50 100 50 Not a triangle
18 50 100 25 Not a triangle
--------- -
19 50 50 100 Not a triangle

20 25 50 100 Not a triangle

8.3.3 Decision Table Based Testing


Decisions tables are useful for describing situations in which a number of cornbinatianl ti
actions are taken under varying sets of conditions. Decision tables have been used tt, tepa • F
and analyse complex logical relationships since early 1960s. We would like to show that MIi'
these may be applied to the testing and how tester may adopt the principles to hia'bel" ...
situation. Some of the basic terms are shown in table 8.2.
Table 8.2: Decision table terminology.

Entry
True
Tr,u Fol,,
Tnl4 Fala, . Faln
X
X X
X
X
".; , I ~ I \. ::,
'!"•·•
-.
-,1
II
~
'I~
! I ::t I;,.
I::.;::.
-,-::II
!u
:All
......JI
":7j
..... .J
-.i.,...
[?war-Testing
~
Year Expected output
1962 Impossible file update is made. If the character in column 1 is incorrect, message :r is 15gued. lf the char-
1964 Impossible acter in column 2 is not a digit, message y is issued"
1962 Impossible The causes are
Impossible ' c : character in columnl is A /1-
1964 1
c2: character in column 1 is B /
1962 Impossible
• FebrUr7
Tec:hniqUe /

c : character in column 2 is a digu /


8
and the effects are
-_.... c... l!llld Gnphing . . . . ha
ftlue analysis and equivalenc~ partJUom~g 1s ~ t these do not
e 1: update made/
e 2 : message x i1< issued /"
O. ....... t l ~ p u t -'--..+ances. These consider only smgle m put conditio
n· w. fll an ~ - - · . . . . . ns e3 : message y is issued /
..... . . af'inputll may result in intere~tmg s1tuat.Ions. These s1t u~t1ons should
The cause-effect graph is shown in Fig. 8 .9 .
-• c,mmder all nlid combinations of eqwvalence classe,-,, the n we will ha,·e large
NOT
• ....._ B'•
.-lilrtflllll~mm!Y
o(which will not be useful for revealing any n ew errors. For example
il'._ . .--.,.•-...&inputconditions, such that· any comb.ma t·10n o fth e m · · · ·
put conditions is
'
~
~
Identity
- '-J
~
0 e:)
.,.._ wewil ...,_.J"_talt cues [JAL096].
0 . . 6d graphing [ELME73] is a technique that aids in selecting, in a systematic
--,. allilli-,illll at af'talt cues. It bas a beneficial effect in pointin~ out incompletene,s and
0 ;)
...... ...,-,tiooa. The fodo~g p_rocess is_used_to den ve te:;t_ca._e~ [~fYE~i9].
OR 0•
AtCl
e:)
L 'Diecaam and~ in the speaficatJons are 1denhfieq. A cause 1s a distinct input
...ai6iiia er an equi-falence ~finput conditions. An e ffect is an output condition 8 V
e, A
• a ..,.em t.nmd'ormation (a lingering effect that an input. h as on the state of the
pnpam • aystem). For instance, if a transaction to n program causes a ma.~t.er file
8 8
Ille........, the alt.eratioo to the master file is a system transformation; a confirmation
. . _ . woa1cl be an output condition., Causes ami effects are identified by reading
dae ,rrific,tim word by word and underlining words or phrases that describe caru:e,
2
aal e&cta. Each cause ~effect is assigned a unique number.
· Tbe-.tic mntent of'the specification~alyzeaaiid1ransfonned into a Boolean
grapb liaking the C&Wlell and effects. This is the cause effect gra p h. / ~
C" v
"\~ -
-----
I'>, •
-~---
A
0
(;)--· ,
~
3
· The graph ia •rmateted with constraints describing combinations of causes and'or
~
4 _ ~~~le because_ o_f s~tactic or environmental constraints ..
,..,
'"~--' Dy tracing Btale conditions m the graph the graph is con verted into a
5
....._ entry deeiaioo tabl E h l
.
· The col WDDII m the decisi
The basic notation
TL:_,_

· '
e. ac co umn m the table represents a test case.
on ~le are ~onvert.ed into test cases. ,
for the graph 18 shown in Fig. 8.8 .
~
8 ;)
i •= of each node 811 ha . the
represents the present at.ate. The~ . value. O or 1; 0 represents the 'absent sta t~• and 1 Although the graph in Fig. 8 .9 repre.,enb the ;:pecific:ation, 1t doe.s not contain an impo5·
·
NOT function states that if •
c, AND
• functi
c, JB l, e, isl; else e 1 is O. The
_tity function states that if c is 1 e is l · else e 1 1s 0. The
1 e 18 0 else
• · 1 ' 1 '
el 18 1. ~e OR function states that if c 1 or c2 or
siblc combination of cause.,-.- it is impo>'sible for both c-a.u;:e$ c 1 or Ci to be ,,et to 1 :;i.multane-
ously. In most programs. certain combination,- of c-nuse,- a n.- impo~ ible bec-au.-;.e of "')"lltactic or
0. The AND and OR functiona are allow on states that if both c 1 and c are 1, e i_ is 1; else e1 15 environmental c-onsiderations. To ncrount for th ese, the notations m Fig ~. 10 i~ u..-.ed. The E
Myen [MYER79] explained tbia ed ~ have ~ny number of inputs.
2
_ constr_a int stntes thnt it must alway" be true thnt nt m o.:.-t one of c orc can be 1 ~c 1 orct cannot
1 2
column l mwn be an A or B. The ~ ~ e l y with the following example. "The character" he 1 simultaneously). The I constraint state.o< that nt l ea,-t on e of cl' c 3 and c3 m\13t alwa~·:' be
( 1. cl' c2 and <'s cannot be O simultanoously). The O ronstraint state.-,. that one, and only one, of
m column 2 must be a digit. In this situation , th e
-
..,._w...-beL

,.~_-:,._...
I and el 'lbeRcomtraint•tates
to be 0). tbat,forc 1 to be I ' c2 must be I ----=::__ ~. :'"V
i.e., it is itn--.....:_
( i' n ,• • • -

- ~- - Oftware En
Jlosaib~

~ Testing

-~--
~-- ..
1.;ssrnplc 8.12
Consider the triangle problem specified in the example 8.3. Draw the cause~ect gra
....0 B
,<:-.</ ~
identify the test cases.
E<_... ..... ..... .....
~.......... _..... Solution
-0 Inclusive '..._ ..._
..........
- \~
--(::)
The causes are
C1
Cz

side x is less than sum of sides y and z


side y is less than sum of sides x and z
side z is less than sum of sides x and y
~ I
~ . . -0 C3
C4
C5

side x is equal to side y


side x is equal to side z
0 R / side y is equal to side z
',,0 I
' •✓,.:---\
~- ~
and effects are
el

c6
Not a triangle
One and only one Scalene triangle
ez
Fig. 8 .10: C'..c,r•.!r.i,nt 'i~"T'Ool Isosceles triangle
e3
Equilateral triangle
There ia frequently a need for a constraint among effects. The M con s traint in Fig. 8. 11 e4
lltatea that if eft"ect r 1 ia 1, effect e 2 is forced to be 0. e Impossible stage
5
The cause effect graph is shown in Fig. 8.13 and decision table is :;hown in tahle
M
0- ' masks
\
\

test cases for this problem are available in Table 8.5.


Table 8 .6 : DE'CISIOO t.::.ble
,:----- --
I
I
1 1
I Conditions
0 1 1 l l l 1 i 1 -----
1,1
I c : X < Y + Z?
1 - ,._ l 1 ' 1 1 1
:.....+ - -. 1-+ 1-
---
0 1 1 1
~ / c 2 :y<x+z? X
l ' 1 1
X X 0 1 1 1
c 3 :z<x+y?
Ag. 8 . 11 , S ymt>.. l lur ma~"'- c.;n:,.:•.imt
-X X X , 1 l 1 1 0 0
c4 = Y? _ --+--
Returninc to the simple eiaotple above, we see that it is physically impossible for causes : X
-- 1--- - -
X
~~
X X l 1 0 0 1 1
and £'2 to be Pftllent BunultaneoUBly, but it is possible for neither to be present. Hence ey c 5 :x=z? ..,__
linked with E CODlltnu.nt as shown in Fig. 8.12. ~
th
c 8 :y=z? X X X I 1 0 I l 0 I 1
1
~ L---
1
-
1
e 1 : Not a triangle
-
~~~
., · · · · · ~T-FI f-
E<:"- - e2 : Scalene
1 i 1
-{~ -
.':_• : ~~~i~ternl_~ - l -----r
~T - i
c 11 : Impossible I t , 1 1 _ 1
-----T'
Fig.. 8. 12
. 11,ea.dwe. the knowledge to the internal structure of the code cu a. aaed f1D Ind Ille
aambs' al test cases required to guarantee a given level of teat coverap. It waalcl -
adviuble to release a software which contained untested statementa and the ~ ol
M
which might be disastrous. This go,l} seems to be easy, but simple objeeti,rea of na...:twal


u,sting are harder to achieve than may appear at first glance.
J· ·~ In functional testing, all specifications are being checked against the implementation,
,. I j 90 wb:, do we really require structural testing? It seema to be necesaary becauae then might
be parts of the code. which are not fully exercised by the functional teats. There may aiao be
~ eections of the code, which are surplus to requirements. That is to say, we have c:heckad the
~ _J program against the functional tests and no errors are revealed, then further inspection by
structural tests re,-eals a piece of code that is not even needed by the specifications and hence
·:.; not examined by functional testing. This can be regarded as an error since it is a dniation
from requ1remen~. It may find tho..."le errors, which have been missed by functional teatiq
NORM89
want to look in to t.he program, examine the code and watch it as it rune. Thia
~ dynamu: and i11 n ~ testing a running program; therefore it is called dyp•rni!:
ling. It ~-'-' wont to test the program without running it; meaning thereby ezarn-
and rm,l"~,ng 1l, thl'n it is calll'cl_stntic white box testing.
9tntic white box tcl'ting is the process of ~efu.lly and methodically reviewing
gn. orchit.octure, or c-ode for hugs without executing it. It is sometimes referred
lllnlrl.urnl nnnl_y1n11 IPA1'TOll. .
....
vcn ton group ofle11t. t.ochniques based on judiciously selecting a set
..... •
... ... rugrnm. If the flct <![Path11 is properly chosen, then it means that we
un.• of u-111. thoroughncfls. Fot example, pick enough paths to assure
nt is c;ccut.cd at least. once. It is most applicable to new software for
Ling. It requires complete knowledge of the program's structure and
unit test their own code. The effectiveness of path testing rapidly dete-
r the softwar<J under test increases. It is rarely, if ever, used for system
loper, it is the hasic lest technique [BEIZ90].
Thia type of testing in;,olvcs:
1. generating a set of paths that will cover every branch in the program.
,_-;:-IC- - -
2. finding a set of test cases that will execute every path in this set of program paths.
~mc:nt· As•
The two steps arenot necessarily executed in sequence. Path generation ri.e., step 1)
IP('rsons..
can be performed through the static analysis of the program control flow and can be automated.
~
Aow graph
• -
• • - ti.._ . _ • •

" ..bh:r:s.· ----


...... cm
=--~•--
· :.- ans. ......_.
, 1 ,1 . .

~ _ ~~ box testing. 1t pen=;:-.:


P C &a la . . _ thia strategy, .-e d e ~ ~
pay any attenuon to.~

The control flow of a program can be analysed using a graphical representation known as flow
.g raph. The flow graph is a directed graph in which nodes are either entire statements of-
fragments of a statement, and edges represents flow of control. Ifi and j are nodes in the program
graph, there is an edge from node i to nodej if the statement (fragment) corresponding to node
100 - -W (s S lOC))•, then we may tty testing the i can be executed immediately after the statement (fragment) corresponding to node i.
.. -·. - t.'
' T' '

~llre ~ ~
a ..,_...._~ ~ eblly be generated from the code of any problem. Th .~
a ea• ! ... D.:• 8 14
.;~.WafWnm.,. -~. · · e bas1c
eoii,

(SeqaMw») (If-then-else) (While loop) (Repeat-until loop)


(Switch statement)
Fig. 8.14: The basic construct of the flow grnoh

We consider a program that generates the previous date, if a date is given as .


for details refer Example 8.2) which is given in Fig. 8.15. Here line numbers are statean illp,a
'fragments of statement. It is a matter of choice to make fragment as a separate menta 1
node or
include fragments in other portion of a statement. 14

Our first step is to prepare a flow graph from the code. The flow graph of previous date
pu,gnun (given in Fig. 8.15) is generated and is given in Fig. 8.16. Such a flow graph helps11.1
to understand the flow of control from source to destination. We want to find paths from thii
control flow and may like to execute every path during testing.
/* Program to generate the previous date given a date, assumes da:,
given as dd :tmn yyyy separated by space and performs error checks on ~i:2
validity of the current date entered. */

tinclude <stdio.h>
tinclude <conio.h>

1 int main ()
2 {

3 int day, month, year, validDate = O;


/ •nate Entry•/
4 printf(•Enter the day value: ");
5 scanf(*%d•, &day);
6 printf(•Enter the month value: ");
7 acanf ( •1a•, &month);
8 printf(•Enter the year value: ");
9 ecanf(*%d •,&year);
/*Check Date Validity*/
10 if {year > 1900 && yeat" <• 2025) {
11 if {month 1 11 month a 3 11 month =• 5 11 m(m th 7 11

month 8 I I month •• 10 I I month • 12 l (


{Co11td i
Independent paths are:
(i) ABFGNPQR (ii) ABFGNOQR
(iii) ABCEGNPQR (iv) ABCDEGNOQR

(v) ABFGHIMQR (vi) ABFGHJKMQR

(t ii) ABFGHJLMQR

8.4.2 Cyclomatic Complexity


The cyclomatic complexity is also known as structural c?mplexity because it gives internal
view of the code. This approach is used to find the number of independent paths through a
program. This provides us the upper bound for the number of tests that must be conducted to
ensure that all statements have been executed at least once and every condition has been
executed on its true and false side. If a program has backward branch then it may have infinite
number of paths. Although it is possible to define a set of algebraic expressions that gives the
total number of possible paths through a program, however, using total number of paths has
been found to be impractical. Because of this, the complexity measure is defined in terms of
independent paths-that when taken in combination will generate every possible path
[MCCA76]. An independent path is any path through the program that introduces at least one
new set of processing statements or a new condition.
McCabe's cyclomatic metric [MCCA 76] V(G) of a graph G with n vertices, e edges, and
P connect.eel components i907(G) = e - n + 2P: 1
Given a program we ~ssociate with it a directed graph that has unique entry and
exit nodes. Each node in the graph corresponds to a block of code in the program where the
flow is sequential and the arcs correspond to branches taken in the program. This graph is
classically known as flow graph and it is assumed that each node can be reached by the entry
node and each node can reach the exit node. For example, a flow graph shown in Fig. 8.21 with
entry node 'a' and exit node '/ '.
The value of cyclomatic complexity can be calculated as
VfGJ =9 - 6 + 2 =5
Here e = 9, n = 6 and P = 1
There will be five independent paths for the flow graph illustrated in Fig. 8.21.
path 1 a cf
path 2 ah e f
path 3 ad cf
path 4 a hea C r
or a b p a b {J r
path 5 abehef
Jdlla aad lndicat.ea that there .24 (c) the (5, 6) entry ui m but the <6, 5i eaary iac. re :a
·~
· . ·cleu that we may have tw0 the entry UI a 111m; the'+' lien ( l e . . _ ~ .....
llll'ltlltler for •previous date
• aad llboald be placed in different
-1dl • ndUllcl to l~ ud 8 respectively ~ 2
·..._.._about the structure of the code and •
2
~ '
....... . . . , _ 8.18 with lta DD path graph. Find
•.. Flow graph
<•
~-
~ ....... ,
•,lllillll•-.!Jllai1i•t.7'ia,
I
.
;, . nwening thereby. aeven independent paths m the DD 3
Flow graph
~ pn,blem given
b
in Example 8.14. Find the cyclomatic
-·•D
~~- ----18 ♦ 2=7
.....
.-
8.4.3._ SP ti _a

ftliam•7
. ._.._.. . .hlail!&IIIBilili;.,,t ia 7_ ~ there are seven independent paths as given in
::
3
's


Wlaena..r .........._..~llllllac.weanint.net.edtofindindependentpaths. The objective 6
• to tnae all . . . .,....._.. ___ once. Path tracing ia not an easy task and is subject to •
.,..._lltheaiaeofan,f-b; ,itbecameeclitliculttodopatbtracingmanua11y. In practice, B
it ia alwa.,a
graph matrix~adTiaaWe . llr taciac tool. To develop such a
ta .llalpmL
be quite tool. a data structure, called
· A graph matriz ia a aq-. matriz with one row and one column for every node in the
paph. 1be size of the matrix (i.e.. the number of rows and collllDDB) ia equal to the number of
DDdaa in the flow graph. So111A eumplee of graphs and 8880Ciated matrices CBEIZ90] are shown
ial'Yc-B-24.
In the graph matriz. there is a place to put every pouible direct CODnection between any
Flow QIIIPh
aode and any other node. A connection from node i to nodej does not imply a connection from
Fig. a.M
Software Engine
en~g I
path ..ad" and three-link path "ahr" av . ,
a1 1ah11, Hence, our ohject,ve 1':I t.c, fi
not de-paths The steps ere g1vcn
operations to obtain th<> set of all paths lwtwl'l•n
A, Ai, A3, ... An-I_ du-paths that are not de-pat.
· nil
to programme and can be used for designing te11ting tools. Draw Ille progr,
llow grapt•
another form of structural testing. It has nothing to do with data now "
u. nere, we -ntrate
....,,,_ on the usage ofvariabl~
~ and the focus point11 arc;
where variables receive values.
Statement where these values are used or referenced.
F1oW graphs are al~ used as a basis for t.hc data flow testing as in the case of path
times, we feel that it may serve as a check on path testing and is treated as
form of path t.t•,rmg [JORG95).
we know, variables are defined and referPnced throughout the program. We may
au.- &. define/reference anomalies:
A Yariable is defined but not used/referenced.
A variable is used but never defined
A variable is defined t'\\icc before it is used.
F,
anomalies can be idenbfied by statjc analysis of code i.e., analysing code without
t. In order to formalise the approach of data now testing, some- definitions are One simple approach
which are discussed below (JORG 951. strategy. In this strategy
docs not guarantee lOOt
ltlons paths that arc not defi
'!be definitions refer to a program P that has a program graph G IP) a11d a set of program Example 8 .20
variables V. The G (P) has a single entry node and a single exit node. The set of all paths in P Consider the program
ia PATHS (P).
input is n triple of pos:1m·
(i) Defining node: Node n e G (PJ is a defining node, of the variable u e V written as intenml 10, 1001 Th{' p
DEF(v, nl, iffthe value of the variable L' is defined at the stat('rnent fragrnc·nt correspondinJ to
node n.
u-..noc1e: Node n E G CP) is a usage node ofthl' variable II c V, written as USE
n), iff'the value of the variable vis used at the' statement fragm,mt c1,r-r1•sponding lo nodl' 11 (111 I 1ml\gt
A usage node USE (v, n) is a predicate use <denoted asp) iff i;tatmn<mt. 11 is a pn!cliC'aln Rlalt'•
(11·1 ,,qual
ment otberwise USE Iv, n) is a computation use ( dPr10ted as <"l . >
(I 1111,.1hd
rw\ Definition U&e: A definition USl~ path with n•sped ton var·iabln 11 ld1111otPd du -path 1
PATHS lPJ such that, for some c• c V, there En-e dl•firw and usage nocli-H DEF Ill, 1111 1-'md all du
IIUCh that m and n are the imtial and final nodes of"the p~tlh. '
tion clear: A definition clear path with reRJJt•et ' to a v11,·iahln '·'
ia a definition use path in PATHS (J> J with initial and finul nodl'B l >EF tu,,,, 1
that no other node in the path 1s a defining node of 11.
and de paths describe the flow of data nc:ross 1,0111'1·11 st.at1i1111•11t.t1 fr 11111
values are defined to points at which tllC' values are 1u;ed The du-puths
~ear are potential 1,xouhle .5R0Js.
.... - ,•
- Software Engineering
11,,l,n•,,c.•,e
:_-=;!nihon
Palla~·
C'rear?
3, 18 no
3,29 no
12, 18 no
12, 29 no ply
16, 18 Yes
16. 29 Ye s
du-paths are 18 out of which four paths are not definition clear. This equation allows usto determm
equate test suite will catch rC'al faultb ba•.{-rl
U.5 llede«ton Testing this scheme does not penalize a test "-UJtf' 1f
Mutation testing is a fault based technique that is simi!!r to fault se~ding, except that mut,..1 _ instance, suppose that test suite A with 100
t.o program statements are ma'cm in order to de~rmine pr_cpert1es ~bout test case~. It is 25 test cases had a score of 49~, _Altho~h A h
buically a fault aimlllation technique. In this technique, multiple copies of a pr_o gram are large as B, and for the small increase m muta
made and each copy is altered; this altered copy is called a mutant. Mutants arc executed with
t.-t data t.o Clet.eniiine whether tt;;°test data arc capable of dct.ecfing the change bctwe£>n the
costs.
oripna] program and the mutated program. A mutant that is detected by a test case is termed
"'killed• and the goal of mutation procedure is to find a set of test cases that are able to kill a.5 LEVELS OF TESTlf,IG
groups of mutant programs [FRIE 95 ). i::- c;.._ -- - c-· i::-----
Our emphasis during testing i~ to e.xamme and mfJCllli. =- ·- _
of testing i.e., individual mod~o thC' ~~~"~ c .• · , ~ ".: -
Mutant.a are produced by applying mutant operators. An operator is essentially a gram-
matical rule that changes a single expression to another expression. The new expression should
modu.le; in r3U possible way:" "o as to detect
be ayntactically legal according to the language. If one or more mutant operators are applied
gates of modules and test their detailed structure
t.o all expressions in a program, the result is a large set of mutants, all of which must be killed
internal £tructure of the software and concentra
by the teat cases or shown to be equivalent to the original expression.
operations that will be reque:-ted by thf' user The...--e
When we mutate code there needs to be a way of measuring the degree to which the to as unit testing, integration testing, .i.nd sy~:
code has been modified. For example, if the original expression is x + I and the mutant for that
Out of the thre.~ tr.adil.ional lf'wl-< oftc--;;
expression is x + 2, that is a lesser change to the original code than a mutant such as (c*22),
methods discussed so fnr in thi~chnptcr ;i~il
where both the operand and the operator are changed. We may have a ranking scheme, where
is understood better than integration tc;:t1
a first order mutant is a single change to an expression, a second order mutant is a mutation to
proach sheds some insight· te:-:t thl' md\\ 1du
a first order mutant, and so on. High order mutants becomes intractable and thus in practice
only low order mutants are used. until the entire s,·sh.•m is tested :3,-stem t
and it oflen bonlcrs on rustomer ~r<'\:•ptanC'l'
One difficulty associated with whether mutants will be killed is the problem of reaching rntlwr than strul't.urnL This is mostlv du
the location; ifa mutant is not executed, it cannot be killed. Special test cases are to be designed cnst's. l n the !l'nditfonnl new. integt.;hon t,'st
to reach a mutant. For example, suppose, we have the code
is not sysh•m lt•st ing. :\tost of the usu.1I disc-us:;
Read (a, b, c);
in whid, units 111·1.• mll'gn\tl'd: top-do\\n. bottom u
lf(a > b) and (b = c) then thn•t• phnst•s, integrnt1t1n is the• least wc-fl und•·
x: • a*b*c; (make mutants; ml' m , m •••.•. J Ernll'S \ocnh•<l dunng testmg nm.Y fall
2 3
be=~
To te th.18 · d · · n•quiro im11wthnt1• nt t1•11llon nn.' usualh of .1 n.1tun' th;:it thcs cr;:i!>\., Lhc -,.::•~~- •
~ , mput omam must contain a value such that a is greater than h and h
Prntion, nnd ll'stn,g rnnnot l'Ontmm• u~bl the~ nn:- rcmc.wed. Scm
lfin~t domain does not contain such a value, then all mutants made at this location hefon, testing ,s rompkll' but rnn tx, 1gnorl'd dunng tht:- 1mmNh.1•- •-•.c•n·• .,,he'd.:.':'
equivalent to the original program, because the statement x: = a*h*c 1s
th e• import1111ce ofremovin~ nn l'i-ror 1-, pr<'Pl't-t10nal to its :,;e"cn
t cannot be reached during execution). If we make the mutant x + y for
..... ~
,......,....., Tbere are errors that may be
-
replace modules that are eubordinate te 'e6il -- =..I
them at the moment; these Will or dummy subprogram uses the eubordinate modaW .....::_,_
••n••L111•w becomea concerned enough to .tion, prints verification of entry, and retuma - ,n
overhead code, called scaffolding repreaenta effort that ii · .._.,
fbr which inaufticient evidence elCi.sts
tion until they become more tractable.
appear in the delivered product ae shown in Fig. 8.29 [JOME ..:i •
~
simple, actual overhead is relatively low. Unfortunately,--,....____,.
with concurrent software.
ly unit tested with simple overhead soft.ware. In such CMell, ~
eel until the integration test step (where driven and . _ an . . - . , A . . . .
is to generate the scaffolding automatically by meam ma i.---. Alllll. . . . . .
--are
~
..-,g other things, allows us to own a single unit in oolation, whilt StLJ ; • . , 11111 . .
system environment by providing appropriate input. oat,-. , -
1
_.
tateraction for the unit. A third and rather ineffective technique ii to llllil . . . . . . . . _ ,
limply to allow incremental addition of modules to a partially integracetl ......,_ I : · ■ . .
the integration testing will also provide sufficient coverage mthe modalr"1 • ...
technique is usually inadequate but nevertheless it is often I M ill 1M
·O
;) The white box testing approaches are normally used for unit
conducted in parallel for multiple modules.
testI:Dg and the - . . - ..
O C) ~
......... lallllng System testing
User "'-
~~
1/
input
Fig. a.a and
~
a-
. . abo carried out alongwith testing. These include test
. . . diac,•eeions with the customer to schedule installation,
matmial et.c. When the product has finally been re•
- . at the end of testing, we want to move immediately into
~~~
dali-tary.
rwming it in isolation from the rest of the
1
Mark's scaffolding
comparing the actual results with the re-
of tbe module. One purpose of testing is to find
. . There are number of reasons in Fig. 8.29 , $-·., •
product [JONE 90) •
8 •5 ·2 Integration Testing
~ "'"'°""'
. . . elllllllp that we can locate an error fairly easily.
we am attempt to test?it in some demonstrably purpo.. of un;t testing i, to d,te,min• that M<h mde........t module ;,
aloo otnented. Tida ,Pvea ULUe ,banre to d,t,nnine that the .,.....,. .,._.. .....,. "
olin- and for t1us reuon ; 0 teg,at~ """"" must he penorwe,l ()oe . ,
tecrati~~is the interface: wht-tht'r parameters match on both sides as, -to ;t.vJW
~
Pll'miuible ranpa, meaning and utilisation [COLL 88).
in isolation. How do we run a - 'l'llonONoeveralclawoal ;nwg,aiwn•u-a-tbat ...U.vhawliul,....,ia•-
, to output intermediate values 08)'. Top down-integration proceeds down the mvocabOn bit-rarchY. addilll one modula
driver routine to call
~.... in it.
- ....
... . .
.,._ .· - - _,4<!! _....~
.-.--"!"·· .,_--_~----...._-
':._.... ..---..a. ....
"' If• l'lt
Ill ► II.I I I ~-
-~--c::-- ,.. >
_,.{~-i - "l
,- . JI
..

.. <'.,..,.,..... ~
-=-~
-~i;:--•J>·--....
..-..·.•-~·t...,..:t!
...,.,..
Sollw11ro l-nai, . ]
"'orinu
£...-L-•L•1 NCOnd rulr 11 that. tc-11t.in11 Uw u1mnl i11 rnon• i111port11111. th ,., ~ tJ_phEJ n~1d h::ln ~.:11t1r1_g I.J•chr11 ,~
-IA 1111 1 ,l 1llll{U
Thi• can be accomplt11hed hy 11uhj(•cl.inK th" 1mflw11rc lo tho kind of' 11 11 ,, t 1., 11 , i1t "' 11 · ,.,,.v
cu11 tom1!rt1. L•,mptll.'rfl , ,,rw·rn ti rig
tlltive o( aet.ual UNI, ... de11crihod in lhl' orwrnl1onnl prn~I~ Tiu, 11,i,,,- rnn.v luJ 11h10 I!, ii,'.;· .. ,uch CUHUJmtJrll aro llf,t. ovriilahl!.. tnit. P,1t.1-r;1
-J•L •L•-Jund orw1tina. In fact., 1oflw11rc l'lll{Hll'Crfl m11y 1•xh1h1t. hl1111l Hpot11 lh111 f:IIIIMP 11 II ltl ·t.,ftirll• TheRH poteu_t.wl t:1J,Hl<,mer11 n r!: rnvil(
" · lf·r111
of ..-it.d to Ull(J Lhe H•ift.w~ re. llw fir'K"(;:!fl 111 camed
WIWIWIHI
aottoe exotic problem1: while, they ignorCI prohlim111 t hnt 111111r would 111,ot 11n111,:di 11 tPly. ''
Third, if we are tefllln11 111\(,r modificnt.ion of an t•xist rng pnuluct, wo Hl ,1,1 ,, r-'I only controlled 1Jrw1r1111mont 111 provid1:d TI;
1111
---1.mdN .
raLher Lhan new onc11. Th u rntronn ' 1101 dPJu:iuliiu,1 ,II.1 ,,i,i
. I. Iwt. I. I10· 11111:r re
Io I11•n• 111 ~aniell arc_ going fi,'.· l,et.;1 rel1:ar;1:a of tht•rr pr
-r-u •· . ..,11111.111, ;,iware in their rc11p 1:1}t1v1: _J1n•rn1lles acroas the o1,
a,,w ftmc:Uou ofLhc 10flwaro, and would not lw pnrnlyscd rl t.hmu: Wero 1101 ni.;ht.. 11 1, fiiil ,
11 11
1"'J onmenl, w1t.ho1JI. ,,ny cimtn,I r,f developer
In Lhe old f\anct.ionalit.y could doju11t lhRt-p11roly11c Uw 11111.•r'11 enl.ir,, op•!l'lllion. vi r
en
iuggeet.ions, and nrny m,,, J'1f'Y t h c c1,d{\ whcrec-vcr ~
The rationale for Pt'l8chcnik'11 testing Jlriorit.il'!I i11 thnt exhnw!liv,, l1J11tin1< of' ,- , •.i.·
1111 11111111 gete the fccdlwck of' many r:•,tentrnl c..1.1storn{·rs without
capabiliLle111 inco~plc_w with l.!1c kind <1f11ho1i updnt,; <'yl'lo impo!H!d 011 m11ny sort w 11 n: produits.
The uccopt.urH'•: t.cs tmg 1H r,or,ul nr with cu·,tor-:'>!-:d h~~,-ar.
Juat a1 dependab,ht.y 111 mon.- rmport.nnt IA1 th<i u11er 1.hnn Uw tot.111 l:orref't IH'HII, thn h11Fii,· lltul
to check tho Rof't.wun: as per f!Xpect.at10n8 Th
~n,r functionality al110 weigh much more lwnvily t.h1111 1111111 fi111rtio1111!1ty l•'on•moHI w,
lanned 11yHternalic R1:ries of lrJBUI. The d uratwn of th
1bould avoid disrupting current uimge hy int rnclucinJ< 11 111•w n:l1:11F11: '!f' th,: pl'oduct I hul woul:l
not 1upport. currrnt. functions. :eeks or monthR. The identified buys will be fixed and
the cuHuimer.
During aystc>m tt>sting, we- Bhoulcl <!vnlunl,: n n11111l11•r of' 11t trih11t1°H of' Uw Hoflwnro lhnt
The rn1•:E haH dcvdop1:d a atand::ird 1 1.EEE
are Vital to Lhf' u,1er 11nd nre listccl in Fig. 8.31. Th1:i-e reprosont. I ho op(•r11t ional ror-n:ct , H of software v1:rific11Lio11 and valida tio n" to provid
111 8
the product and mny he purl ofth,i soflwnrl' Sp<'cilirnt.ions [,JONI•: 901.
documenting the taRks r<'quircd by t he st.and:ird
U1able plan !IEEE !l:JI, Validation tes tin g improves thequalr
l11 the produrt convenient, clunr, und predkt~1hlu'l
capabiliti(:R and quality attributes The quality n
These attrihut.es Rcrvu the customer's need for a so!tll·are
Compatible object.ivcs wit.h adequate performance Y.,th n o ~
Will tho produrt work rn1-.-1irtly in ,·onjunctwn with exi11ting dntn, soft -
wnro, 1111d procNlun•s? are accuracy, completcnc:.;s, cons is te ncy, correctness
·-
Do adl•quuhi t111fi!l{U1trdB ngninHI fililurn und mcthncl!I for n•cnvcry oxiHl
-- - -- reliability, tcRtnbility, usability etc Some custom
in the produ<'t'! validation l<'Rting. A systemnlic pl a n m ny rc.,qilt 10to gooa ,;::..:.;. -•
Aro mnnunls rnrnplutl', corre,·t, nnd uncl1•rst11nd11ble'!
_ 8.31; A
-~ -~- -~- ---1--.f'.JbYf»\
v,./W.
~ ART OF DEBUGGING
f,o 'I(
twu.t, t"..AA)J •
As discu1ssC'd earlier .(i_he goal of tc;:t ing 1s to 1dcnufy £M'Cf'
//MA

~ IDATION ~
• I
s 111WG\ LI\. / 'J-d ~
\,,.
_ ~
M~i j.c ~:
\ _,,. ·'-'ti
I '
'AJA' of testing generates symptoms , a nd n program'!- fatlure
an error. After getting a symptom , \\ C be-gin to in,~
\_ \'
After idcntilicat ion 11f ph1l't', wc t'.'-!\m111c that po.mien to
It refers to test the software asJl~plel,e_product. This should be done.after unit and integra- proce8H is l'alh•d dcbuggin~.'
tion testing. Here, we want t.o test the software with the perspective of the customers and mny . Qlenn,. dt!hugging i~ tht' activity ,if local
like t.o ensure that the software meets the expectations of the custom~. We may ob,o check fmlun~ hns lwen \ktt•t·tl'd . Unfortunn tl'l,Y . ~Ol: f
all enteric.s of validation criteria section of the S_RS documeni-:- 1'rro,· that is n•sponsibli.', is for from tr i\ inl. lt is one
lt may not be possible t.o predict every usage of the software by the customer. We mny dt-vt'\opnwnt, nnd is pnll'ti,-l'd with tht• lcast ,mlt)\l
plane very systematically and seriously ; but beha,;our of customers may very drastically. lll\ll'h hopt• nnd lit th- plnnning'{GHEZ ~l O
They may try strange inputs, combination of inputs and so on. Some results may be vrry
obvious for developers and may not require any explanation, however, customer may not
andentand correctly and hence may not appriciate it. In order to avoid or minimise such
tiona, the involvement of cu.c;t.omer is required during validation testing. Al phn, beta ar1tl
ecceptance testing are nothing but the various ways of involving customers during testing.
-~----- . .

~
nl techniques for debug:guig_ ~
. llerath
as not an t!-8$) proc-ess. This is Pro'--b •

Tabl9 &I
A printo
lec:hnology. En-or remo,-a.l requires hurn:1. •
code we ha,-e created and requires nn o=n •
"""'
IJ.Jl\' lo nnd relev
locnlions 1
_ does rather than it should do. Commenting "" Dlllld
studied
SHNE 80]. states: should be 'l\·e
ted nnd rl:'
parts of programming. It has element,- of Problein
possible Uf.e on
.th the annoying recognition that we haw made a m1:<take sequpnt problem
_. tbe unwillingness to accept the po..'X-ibility of errors, mcreases the
there is a great sigh of relief and a les,:ening of ten:,1on when the
maa:ter.
• • Pl ➔ [PRES 97] explained few characteristics of bugs that pro,ide some clues .
""llie-, 1 • , and the cause may be geographically remote. That is. the ,-:ymptom
a.r appear in one part of a program, while the cause may actually be located in
. . _ ,-rt. lligb1y 00Upled program strnctures may complicate this ,;ituatiori.
2. ,.._ -,mptom may disappear (temporarily) when another error is corrected. 2. Traces
'Ille aymptom may actually be caused by nonerrors ce.g. round-off inaccuracies). memory and regts
occurringe. Typical co
4. '!'lie aymptam may be caused by a human error that is not easily traced. subroutine. statcm
I. 'l'he a,mpt.om may be a result of timing problems rather than processing problem". printer. disk. or oth
6. h may be difficult to accurately reproduce input conditions (e.g. a real time applica- (4 l timed actuatiDD,
1:ilm in which input ordering is indeterminate) . problem with trace p
language and any c
7. Tbe symptom may be intermittent. This is particularly common in embedded sys- The standard pnnt ,-tate-
3. Print statements
tans that cou~le hardware with software inextricably. ment in the lan~oe be-
8. Tbe aymptom may be due to causes that are distributed across a number of tasks i ng used 1s sprinkled
nmning on clilrerent processors". throughout the program
to output values of key
. A namber ol popular techniques are given in table 8.8.
variable-"
ln.-neraJ. noaeoftheae techniques should be used without a thorough prior analysis of
aympt,maa the error resulting in a hypothesis concerning the cause of the errors. For instance,
if two modules behaff properly when operated separately, and a failure occurs when they are
iDt.elrat.eei, their interface should be checked for consistency. 4. Debugging A program wh1c-h ruru-
Programs l'Oncurrently ,nth th~
1.7.2 ~ AppcWhN pnlgnun under t.-st and
prcwidl'S ,:-ommands t
• 11emt al debugging Proceae is not the debugging tools, but the underlying approaches us('(! ( l) ex:,nnne mem~· and
to dedace t.be cause of the error.
regi.><ters; (21 :;top ,.,,ec
tion (lf tht' pnlgl-am at a
pnrtirulnr pl>int
SN\l'('h for rd\•re
port,c-ulnr const
vnrinbles, rcctst

You might also like