Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Journal of Positive School Psychology http://jou rnarpp*.

li*
2022, Y ol. 6, No. 10, 3428-3437

Structural Methods For Program Testing


M.M.Aripov

Associate Professor of the Department of Informatics, Kokand State Pedagogical Institute , ;, ' , ,,,:

:'
,,,,a,,.,,,::...:,
,.-.--
such as branch testing? program
Abstract Structur-al methods for:progranr testrlg arc clesoribed,
-
verification, symbolic testing, and generating structural tests. Arr algorithm for the minimnm coverage of
the program graph based on the packing adjacency nralrix ancl a specific example of the minimum coverage
of the program graph are given.
,''
Keywords . testing, program graph, minimum program graph coverage, packed adjacency matrix, DD-
paths, vertex, branches, g-graph, h-graph, algorithm complexity.

INTRODUCTION execution of the loop with a return, and the other


Testing - checking the operation of the prograln rvould go through the loop without return.
based on the results of its execution on spccially .

selected sets of initial clata - tests. The prograllr Prograln verification. Any testing using
can be tested either completely (full testing) or numerical sets of initial data allows you to check
selectively (selective testing) at indiviclual points the progrant only in a limited number of points in
in the source data space. With random testing, the the space of initiat data, so more general methods
reliability , of ,€t, program cannot be fully are of greatest interest. This includes, ftrst of all,
guaranteed. If tests are offered by the the verification of programs - the proof of their:
programmer, then they can cover only those parts correctness using mathematical methods for
of the program with which the programmer is proving theorems. To do this, the program is
most familiar. Therefore, many hidden errors presentecl as a sequence of more or less simple
may remain undetected. Full testing on all statements, the proof of which is not difficult.
possible input sets ofthe program or even testing This process can be automated, but practical
ofall paths in the program structure is unrealistic, results'in this clirection are still insignificant. The
since the number of tests will be unacceptably fact is that the proof of .even relatively simple
large. For example, if the number of inputs is ten statenrents is a procedure that requires high
and each input of the program can take on ten qualifications and is subject to automation only in
values, the number of elementary tests reqtrired to some rare. cases. Due to the great complexity of
cornplete the test would be 1010. the proofl, crrors are possible here, which from a
practical point of vierv, despite the apparenf,iigor',
:

Branch testing. A more stringent requiremertt is lead ro the fact that the verification meihod
:that the.chosen paths must span all branches of cannot guarantee the complete reliability of,the
the program structttre, or all branches across the; verifiecl pfogram. I r ': ' :: ::::

board (dynamic testing or branclt testing). This


approach ensures that all statements and all Symbolic testing. In cotttrast to verification,
branches are tested once. Expet'ietlce sltolvs tltat progranr testing consists in checking the
a significant number of errors arise due to correclness of the numerical results of pfogram
inaccumcies in the formtrlation of exit conditions operation rvith specially selected'values of input
from loops, so it is proposed to inlroduce att varirbles - test scts. In sonre cases, ffiing can
additional requirement that each loop be tested by also be. dotre symbolically
two tests, one of rvhich lvoulcl lead to the procccfrries basecl on symbolicfi s (notations

Pzz
of input variables that allow expressing program Generation cf structural tests. The
outputs also in symbolic form). Different shoffcomings nrentioned above are devoid of
symbolic inputs and outputs correspond to structural testing of programs on specific
different program paths. If there are a limited numerical initial data [1-,3]. Test generation
number of such paths, then symbolic execution consists in choosing a set of paths that completely
can be used to validate the program using cover the program graph, and in detennining the
symbolic input and output expressions. The test data on which these paths are executed. A
advantage of symbolic testing over numerica! program graph (control graph) is a structural
testing is that if a numerical test allows you to model of a program that shows the relationship
check the operation of a program on individual betrveen its elements. The vertices of the gruph
numerical values of input sets, then symbolic represent the branching and union operators, and
testing operates on sets of initial data determinecl the arcs represent the data processing and
by constraints. Symbolic expressions of prograrn transmission operators. The graph is represented
paths can be obtained either. by foru,artl as a packed adjacency matrix (PAN4). The packecl
substitution or by back substitution. Direct adjacency nratrix A : { ail} of a graph with v
substitution corresponds to the actions perfom.red ';crlices is a (v x l) matrix (l is the maximum
when implementing a certain path in the progranr exit degree of the'i-th vertex). The degree of entry
structure. With direct substitution, symbolie dino(vi) and exit dout(vi) of some vertex of the
execution is carried out for each executable graph means, respectively, the number of
statement with storage of intermediate symbolic incoming and outgoing arcs from the vertices.
expressions of variables. ln the case of back Each-row i of the PAM is filled in random,order
substitution, restrictions on the input variables are with the numbers of vertices that are adjacent to
built "from the bottom up" when passing the path ';ertex i. The representation of graphs in the form
on the program graph in the opposite clirection, of PAM has the follorving advantages over other
As a result, the same restrictions are obtained as existing representations: . for jar.ge graphs, the
in direct substitution. However, rvith back number of colurnns of PAM is much less than the
substitution, no memory is needed to remember number of
columns of the rcorresponding
the symbolic records of variables. But rvith direct adjacency, matrix; it is relatively easylto model
substitution, there is the possibility of early the process of moving along the,giph to build
deteotion of unfeasible paths with conflicting paths; reduces graph processing time. The test
constraints on the initial data. In symbolic testing, criterion is the criterion of branches, where a
cyclic sections of the program present a certain program branch: is understood,'as,a certain
difficulty, since in this case the number of sequence of statements that are executed strictly
iterations is unknown. The problem can most one after another. Thus, a branch is a linear
simply be overcorne by substituting some pre- section of a program..To construct the minimum
estimated number of iterations. Horvever. in this coyerage, the graph is divided. jnto DD-paths
case, the resulting restrictions may not be using'the CMS of the original graph. The set of
accurate. The second difficulfy is related to the vertices rvith outpurt degree doul(v;)>l, input and
presence of modules in the program. The latter is output vertices are denoted as D-vertices. Then a
overcome by the symbolic execution of the DD-path is a sirtrple path between two:,D-vertices,
modules encountered on the given path. The thircl such that there are no ,D-vertices within its
difficulty is related to the symbolic execution of boundaries. Then the cycles and loops are
data arrays. The fact is that in some cases the determined and the arcs closing thenr are
valtre of the variable is set only during the excluded.
execution of the'program. This difficulty can be The proposecl algorithm for constructing a
overcome: , by introducing , adclitional minimum cover (MPOC).of a graph, conSists of
(hypothetical) restrictions corresponding to the foliowing steps. ," | ,,. , ,,., ,

various possible cases.


. ,,- !f.ag. 1. The vertex i is leokqdthrough
and tl-ic'ladjacent vertex j is determincd, the
i' :' :,:

tl ii
t
r::' ii
l: 11
o(lvlxlml) => ," o(lvl):, '. ' :

', The, develQp,ed , algorithm is more


in
efficient than the'algorithm:proposed [5], since
in this algorithm the vertices are excluded after
creating a certain" path,' i.e. .additional time
required.

Literature.

1.. Iyudu KA.,r Aripov M.M..Automating'' '


the generation ofpathsfor testing I

-progra*s'. .written : in ' Fortran'


Programming, .1986, No. 7. -.

2. Iyudq K.A.,,.Aripov M.M.'Testing' a' ' :.. t i

progranSb-ased on the nirinimum coveraggr -:' -, .: :' .


-. .'s
'

of its graPh: ,Cqntrol ,sYstems and


machines, 1985, No. 6. . +,

l; Iyudu:I(,A,, Aripov M.M''Automation of -


i
structural testing of Programs;
fi.epublican" conferenoe'','Re li:ibi I ity and,

,quality of sofrvare.'Abstracts: of repor:ts,


29-31, 1985
Lvov, January L>-Jtt
*." I-Y(}Vr,.lalrufuy taoJ ". -'
4.',. .Kulikov.$.S,: Softwa&' testing' Minskt
202"0.: ,,- : '.

',I,",$irnon' C.;, Ntafos, S.; Louis.Hakimi. On


.,"slructured digrafs3nd prognam i - ,ii.i

,, , . GstingilEEBTranS:.On Comptrtgrs, vol. C.


30,Ilb1,January'1981.' ' '. '
- .;;t.:- . i.'r.'.,

r_t.
it - i-'

il;l l;i; -'


'': \. . ti
t.g.;:. _;.

. :..

i :,:.
'!

r.: .f ;'r;, i

;:i i
-' ..' ' :ji:"''ri '
li.
.-t: t.a ':i;liti.'+::: ?ill.iii
.
'::;: .,: : : "
j.;. rl
!...:..,r:r"

. , ..il:1, : ':t j :'j-'


^,.,

._.. -"r,.it ii

You might also like