Professional Documents
Culture Documents
for Modules
Denise M. Woit
Dept. of Computing and Information Science,
Queen's University,
Kingston, Ontario, Canada K7L 3N6
woit@qucis.queensu.ca
depth= 0 0 0 1
depth= 1 20 .1
; :::; .1 .8 to in the Table Section.
depth= 21 .1 .9 0
The Table and Functions sections are manda-
FUNCTIONS: tory. The condition functions, the init sub-
program and the Sets Section may not be re-
init: integer depth = 0 quired in every specication (see Sections 3.2 and
f13():
f21():
depth=1; return 2
return 2
3.3.)
f22(): depth=depth-1
if (depth=0) return 1 else return 2 Specication Semantics:
f23(): if (depth<20) {depth=depth+1; return 2}
elseif (depth=20) {return 3} An operational prole specication, S , described
f31(): return 3 using our technique, corresponds to a set of test
f32(): return 2
cases, TS . Given some specication, S 1, and test
SETS: case, t, of length tn , t is in TS 1 i for all execution
prexes, E1 :E2 : : : : Ei , of t, E1 :E2 : : : : Ei 1 is in
X={1,2,...50} some EPj , say EPx , of S 1, Ei is in some ICk ,
say ICy , of S 1, and Px;y is non-zero in S 1 (1
Figure 2: Example operational prole i tn).
3.2 Table Section:
ational prole specication; we consider the se-
mantics of our technique to refer to additional Table Syntax:
properties that determine the test cases that are The table is derived by modifying the template
described by the operational prole specication. appearing in Figure 3; the user modies the tem-
The syntactic information is necessary to deter- plate by lling in the cells labeled ICj and Pi,j
mine the form of the event descriptions that com- (1 i m and 1 j n) with input class
prise test sequences. The semantic information is descriptions and probability values, respectively
needed to determine where the event descriptions (described below.) Column 1 of the table is con-
may appear in the test sequences, and sequence sidered to be the column labeled IC1. The col-
length. umn labeled HISTORY CLASSES can be omit-
ted: if not omitted, its entries are user comments
3.1 The Specication in General (the comment in row j+1 of this column should
Specication Syntax: explicitly describe EPj , for the user's reference,
1 j m.)
An operational prole specication is a document
that may consist of the following three parts: Input Class Descriptions: For simplicity, we
Table Section: A table having m + 1 rows, n refer to the input class description in the cell of
columns and an optional comment column. the table labeled ICi as ICi , for 1 i n. ICi
is of the form ECi :: Ci . The \ECi " is an ac-
Functions Section: At most (n m) transition cess program or an input variable event descrip-
functions, fi;j , where 1 i m and 1 tion (all arguments of type input or both represent
j n: At most f condition functions
P APN, kFak ,, values) or an event description template (at least
where 1 k f , and f = v + ki=1 i one argument of type input or both represents a
where v is the number of module input vari- variable.) When an argument of type input or
ables and ai is the number of arguments of both represents a variable, the argument must be
described in the Functions Section of the spec-
HISTORY INPUT CLASSES ication. The semantics of such functions are
CLASSES IC1 IC2 ICn described in Section 3.3. If ECj is an event de-
P1,1 P1,2 P1,n scription it is said to belong to ICj . If ECj is an
P2,1 P2,2 P2,n event description template, then the event de-
.. .. .. .. scriptions that can be obtained by replacing the
. . . .
Pm,1 Pm,2 Pm,n < v1 >; < v2 >; : : : < vvn > in ECj with values
selected according to the A1 ; A2 ; : : : Avn , respec-
Figure 3: Template for table tively, of Cj are said to belong to ICj . The belong
to relation is denoted 2.
Let ICGi be the set of event descriptions that
enclosed in angle brackets, i.e., <v>. Arguments belong to input class ICi . It must be the case
of type output must be represented by variables, that the ICi are formed such thatSthe ICGi par-
and are not enclosed in angle brackets. Argu- tition the input space; i.e., I ni=1 ICGi and
ments must be separated by commas. ICGj \ ICGk =
6 for 1 i; j; k n and j 6= k.
If ECi is an event description then \Ci " and Thus, the columns of the table can be seen as
\::" are omitted from the input class descrip- representing a partitioning of the input space.
tion. If ECi is an event description template,
then assume there are vn variable arguments of Probability Values: We assume that given
type input or both in ECi , and assume, without any execution prex, the user can determine the
loss of generality, that these variable names are probability that event E will be issued next,
v1 ; v2; : : : vvn , and that vj appears before vj +1 in 8E 2 I . Let the set of required, unique execu-
ECi for 1 j < vn. Then Ci is of the form tion prexes be referred to as MP . As before, we
A1 ^ A2 ^ : : : ^ Avn (a conjunction of condition assume the user partitions MP into S m groups,
m
EP1 ; EP2 ; : : : EPm ; i.e., MP j =1 EPj and
components), where Aj (1 i vn) may have
one of the following two forms: (1) \vj in S", EPk \ EPl =
6 for 1 j; k; l m and k 6= l.
where S is a set that is dened in the Sets Sec- The EPi must be formed such that 8X 2 EPi
tion of the specication; (2) \vj = F", where F and 8E 2 ICj , the probability that, in actual
is a syntactically correct call of some condition operation, the user expects to issue event, E ,
function, F, that is dened in the Functions Sec- given that s/he has already issued the sequence of
tion of the specication. events represented by the execution prex X , is
Pi;j . Because the ICPj partition the input space,
Probability Values: A probability value is a it is required that nj=1 Pi;j = 1 for each i in
real number in [0,1]. For simplicity, we refer to [1; m].
the probability value in the cell labeled Pi,j as We assume the EPi correspond to the rows of
Pi;j . the table; i.e., row (i+1) of the table corresponds
to EPi for 1 i m. Thus, P(next event will
Table Semantics: belong to ICj j current execution prex belongs
to EPi ) = Pi;j in the specication table. By con-
Input Class Descriptions: The condition vention, 2 EP1 ; i.e., EP1 contains the module
components (the Aj ) of some condition, Ci , can prex corresponding to module initialization or
be of one of two forms, as described in Section re-initialization before the issuance of any events.
3.2: vi in S or vi = F . The rst form indicates As noted in Section 2.1, the EPi need not be
that a value for variable argument vi is selected described explicitly in the table; instead, they
according to the uniform distribution on the val- can be characterized by a set of transition func-
ues in set S , which is described in the Sets Sec- tions, fi;j , dened in the Functions Section of the
tion of the specication. The second form in- specication (1 i m; 1 j n). The tran-
dicates that a value for variable argument vi is sition functions characterize the EPi by deter-
calculated by the condition function, F, which is mining which EPi execution prex E1 :E2 : : : : Ej
belongs to, given knowledge of which EPi execu- init Sub-program: The user employs sub-
tion prex E1 :E2 : : : : Ej 1 belongs to and certain program init to declare and initialize all global
other information about E1 :E2 : : : : Ej 1, such as data structures needed in the transition and con-
the value of j , or the values of certain arguments dition functions.
in the event descriptions in E1 :E2 : : : : Ej 1. Such
other information is user-determined, and main- Condition Functions: Any functions used in
tained in global data structures which the user any conditions in any input class descriptions
must declare and initialize in sub-program init. must be dened in the Functions Section of the
The values of these data structures are updated specications. As described in Section 3.2, one
and referenced in the transition functions, which such function, F, corresponds to a particular vari-
are described by the user. able argument, < vi >, in a particular input class
description, ICj . F may modify and/or reference
3.3 Functions Section: any data structures that the user has declared
Functions Syntax: and initialized in sub-program init. F returns a
string representing a value which is selected from
Transition Functions: For each non-zero Pi;j the possible values for vi (which are determined
in the table, the user must dene a function, fi;j by the user) according to some distribution on
in the functions section of the specication. fi;j the possible values (also determined by the user),
must be a syntactically correct, zero-argument, or which is calculated as a function of the values
C function, Fi-j(), of type integer. of some data structure that is maintained by the
user (function determined by the user.) For ex-
init sub-program: Sub-program init is a ample, ICj could be \push(<a>) :: a in S", or it
syntactically correct, zero-argument, C sub- could be \push(<a>) :: a = F". In the rst case,
program, init(). a value for variable \a" is automatically selected
according to the uniform distribution on the ele-
Condition Functions: Those functions ap- ments of S; in the second case, it is obtained by
pearing in conditions in the ICi s must also be calling function F.
dened in this section; they are syntactically cor-
rect, zero-argument, C functions, whose names 3.4 Sets Section:
are selected by the user. Sets Syntax:
Functions Semantics: The Sets Section is composed of s subsections,
where s is the number of unique sets referred to
Transition Functions: Fi-j() returns one of in the table section of the specication. Without
the integers 1; 2; : : : m. 8P 2 EPi and 8E 2 ICj , loss of generality, let the unique sets referred to
Fi-j() returns k such that P:E 2 EPk . If the re- be named S1 ; S2 ; : : : Ss . Then section i of the Sets
turn value of Fi-j() diers for dierent execution Section is a syntactically valid zero-argument, C
prexes in EPi then the user is responsible for sub-program, SET-Si().
dierentiating between them in Fi-j(). The user
does this by using global data structures which Sets Semantics:
are declared and initialized in sub-program init
and which are modied and accessed in the tran- The purpose of sub-program SET-Si() is to de-
sition functions. In the simplest case, 8P 2 EPi , clare and initialize an array, A-Si [1..ni ], where ni
and 8E 2 ICj , P:E 2 EPk ; i.e., Fi-j() simply re- (determined by the user) is the number of unique
turns the integer k without referencing or modi- elements in the set named Si . The user must de-
fying any data structures. termine an ordering of each Si ; in function SET-
A special, global, boolean variable, END (de- Si (), the user must assign the j th element of Si to
scribed in Section 4), is available to the user for array element A-Si [j], for 1 i s; 1 j ni .
use in the transition functions. The type of the array must be string.
4 Test Case Generation Algo-
rithm
In Figure 4, we present a pseudo-code algo-
rithm for automatically generating random test
cases according to any operational prole speci-
ed with the technique described above.
In the algorithm, we assume the following pa-
rameters: NUM-TC: an integer indicating the
number of test sequences to be generated; ML:
an integer indicating the maximum length of any
test sequence; END: a boolean which is true only
Fi;j 0, i 2 [1; m]; j 2 [1; n] when the user considers the current test sequence
for k = 1 to NUM-TC do long enough, even though test case length is less
init than ML (test case length can vary, since length
TC of module executions can vary); Fi;j : an n by m
i 1 *assume 2 EP1 * integer array that is used to count the frequen-
j SelectColumn(i) cies of events in the test sequences (required to
E SelectEvent(j) determine if the test sequences generated by the
Fi;j Fi;j + 1 algorithm are statistically typical of the opera-
TC TC.E tional prole specication{this topic is not ad-
length 1 dressed in this paper); TC: a sequence of event
while (length < ML) & not(END) descriptions that is the test sequence currently
i fi;j being generated.
j SelectColumn(i) Two functions are used in the algorithm: Func-
E SelectEvent(j) tion SelectColumn(i) randomly selects one in-
Fi;j Fi;j + 1 put class, ICj according to the probabilities
TC TC.E Pi;1; Pi;2 ; : : : Pi;n. Function SelectEvent(j) re-
length length +1 turns a string representing one event description
end-while 2 ICj . If ICj has no condition, then event de-
write TC to le TCASES scription ECj is returned. If ICj has a condi-
end-for tion, then the event description is formed from
write all Fi;j to le FREQUENCIES event description template ECj by replacing each
< vk > in ECj with a value (in the form of a
string) selected according to condition compo-
nent Ak (see Section 3.2.)
Figure 4: Algorithm to generate test sequences
5 Conclusions and Future Work
We have presented a technique for specifying op-
erational proles for modules, and an algorithm
for automatically generating test cases accord-
ing to one such specication. Our technique will
allow more precise operational prole specica-
tions; thus, the resulting statistical estimations
may be more meaningful. We plan to apply our
specication method to real-life cases in order to
assess its practical potential. Related work in-
volves developing a method for calculating statis- 33(6):836{48, June, 1990.
tical estimations based on the results of executing Previous versions:
and verifying the test cases; the method should Technical Report 88-220, Dept. of Comp. &
take into account the operational prole. Future Info. Sci., Queen's University, May 1988.
work involves developing a software tool based Proc. Intl. Working Group on Nuclear Power
on our test case generation algorithm, and devel- Plant Control and Instrumentation, IAEA
oping a tool to calculate statistical estimations NPPCS Specialists' Meeting, International
based on the results of executing and verifying Atomic Energy Agency, London, United
the test cases [13]. This work, along with the Kingdom, 10-12 May 1988.
work of others involving automatic test case ex- Proc. Seventh Intl. Conference on Testing
ecution and verication [8] will comprise a com- Computer Software, San Francisco, June 18-
plete, automated method of obtaining statistical 21, 1990, pp. 89-117.
estimations for software modules, based on test-
ing. [6] D.L. Parnas and Y. Wang. The trace asser-
tion method of module interface specica-
Acknowledgements: I would like to thank tion. Technical report 89-261, Queen's Uni-
David Parnas and Roman Viveros-Aquilera of versity, 1989.
McMaster University for their encouragement [7] T.A. Thayer, M. Lipow, and E.C. Nelson.
and helpful discussions regarding the work in this Software Reliability. North-Holland, New
paper. Thanks also to James Whittaker, of Soft- York, 1978.
ware Engineering Technology, Inc., and Pierre-
Jacques Courtois, of the University of Louvain [8] Y. Wang and D.L. Parnas. Trace rewriting
and AIB Vincotte in Belgium, for their comments systems. In Proceedings, Third International
on preliminary versions of this work. Workshop on Conditional Term Rewrit-
ing Systems (Pont-a-Mousson, France, July
References 1992.), pages 1{21, 1992.
[1] J.R. Brown and M. Lipow. Testing for soft- [9] S.N. Weiss. What to compare when com-
ware reliability. In Proc. Intl. Conf. Reliable paring test data adequacy criteria. Software
Software (Los Angeles, CA), pages 518{527, Engineering Notes, 14(6):42{49, Oct., 1989.
April 1975. [10] S.N. Weiss and E.J. Weyuker. A generalized
[2] R.C. Cheung. A user-oriented software reli- domain-based denition of software reliabil-
ability model. IEEE Trans. Software Engi- ity. In Proceedings, Workshop on Software
neering, SE-6(2):118{125, March 1980. Testing (Ban, Canada, July 15-17, 1986),
pages 98{107, Washington, DC, 1986. IEEE
[3] J.W. Duran and S.C. Ntafos. An evaluation Computer Society Press.
of random testing. IEEE Trans. Software
Engineering, 10(4):438{444, July, 1984. [11] S.N. Weiss and E.J. Weyuker. An ex-
tended domain-based model of software reli-
[4] K.W. Miller, L.J. Morell, L.E. Noonan, S.K. ability. IEEE Trans. Software Engineering,
Park, D.M. Nicol, B.W. Murrill, and J.M. 14(10):1512{1524, October 1988.
Voag. Estimating the probability of fail-
ure when testing reveals no failures. IEEE [12] James Whittaker. Markov chain techniques
Trans. Software Engineering, 18(1):33{42, for software testing and reliability analysis.
January 1992. PhD dissertation, University of Tennessee,
May, 1992.
[5] D.L. Parnas, J. van Schouwen, and S.P.
Kwan. Evaluation standards for safety crit- [13] D.M. Woit. Operational-based test case gen-
ical software. Communications of the ACM, eration and reliability estimation for mod-
ules. Ph.D. Research Proposal, Queen's Uni-
versity, 1992.