




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































fshekar,[email protected]
(^1) Currently employed at U S WEST Technologies, Boulder, CO. [email protected]
Abstract
There is an increasing demand for innovative software that satisfy stringent quality and reliability re- quirements imp osed by users. In recent years Ob ject-Oriented (OO) paradigm is gaining acceptance for developing complex software. The current research so far in OO software engineering is fo cussed on problem analysis, software design and implementation techniques resulting in a p otp ourri of rep- resentations and pro cedures. Even though the imp ortance of Veri cation and Validation (V&V) is known, it has commanded little attention in OO paradigm. In this thesis^1 we prop ose a new sp eci cation technique called Metho d and Message Sequence Sp eci cation that represents the causal relationship b etween the instance metho ds of a set of classes. The Metho d Sequence Sp eci cation (MtSS) of a class do cuments the correct causal order in which the metho ds can b e invoked at an instance of the class. The Message Sequence Sp eci cation (MgSS) of a set of classes do cuments the causal order in which messages can b e sent to instances of di er- ent classes. MtSS and MgSS of classes do cument the message-metho d interaction and the correct sequence in which messages can ow through a system containing ob jects. The imp ortance of sp eci cation Consistency and Completeness (C&C) is well known in software engineering. Inconsistency and incompleteness in MtSS and MgSS would lead to faulty design and therefore, C&C of class sp eci cation is essential for developing OO design with less faults. In this thesis, we provide a set of rules for developing consistent MtSS and MgSS for b oth single classes and a set of classes. We also discuss ab out run time veri cation system that can ensure that each ob ject is compliant with the corresp onding MtSS. The implementation of a OO design must comply with the design. We prop ose a new technique of data anomaly detection in OO implementation using MtSS. We then prop ose several test case generation techniques using MtSS and MgSS that can b e used for testing the OO implementation. We also present the results of applying various testing techniques against an example OO program.
(^1) This technical rep ort is a short version of the do ctoral thesis by Dr. Kirani [40].
i
There is an increasing demand for innovative software that satisfy stringent quality and reliability re- quirements imp osed by users. In recent years Ob ject-Oriented (OO) paradigm is gaining acceptance for developing software for complex applications. OO paradigm has moved into mainstream software development industry. It is currently b eing used in variety of applications development starting from system software such as databases, op erating systems to application software for banking, billing, service providing and so on [12, 66]. Software is inherently complex and this complexity of the software is its fundamental prop erty, not an accidental one. The complexity is due to diculty in comprehending the problem domain completely, the exibility in software and diculty in managing development pro cess [13]. OO software development is based on identifying and mo deling the real-world entities as ob jects. OO paradigm supp orts abstraction, decomp osition, encapsulation, mo dularity, and hierarchy. Thus OO-based software engineering is seen as an approach for tackling the intricacies and complexities asso ciated with software construction [51, 12 , 47 ]. The current research so far in OO software engineering is fo cussed on problem analysis, software design, and implementation techniques resulting in a p otp ourri of representations and pro cedures [51, 12 , 18 , 19, 47, 54 ]. OO analysis metho ds help in identifying and expressing software requirements in the vo cabulary of classes and ob jects found in the problem domain. OO design metho ds facilitate in identifying the relationship among ob jects and help in depicting b oth static and dynamic mo dels as well as logical and physical mo dels of the system. During design, many of the ob jects and classes identi ed during analysis are retained and are re ned. During OO implementation, each of the classes and ob jects that were designed are constructed in such a way that they conform to the static and dynamic mo dels built during design. It has b een studied that Veri cation and Validation (V&V) related activities consume at least half of the lab or to bring out a pro duction quality software [9, 78 ]. In conventional paradigm, statistics show that a software programmed well will still have one to three bugs p er hundred statements [75]. This quality of the software is not acceptable in many critical applications such as nuclear reactor control [58], or safety critical systems [53]. Even though the imp ortance of (V&V) is well known, it has commanded little attention in OO paradigm. A sound software engineering practice is to verify and validate everything that is develop ed. Thus, extensive V&V during software development is essential for building zero-defect software [21]. Unfortunately, most of the OO analysis and design techniques prop osed to date do not adequately address V&V activities. Currently, most of the V&V
OO Analysis
OO Design
OO Implementation
OO Specification
OO Source Code
External C&C
Internal C&C
Thesis Concentration
Figure 1.2: Veri cation and Validation of OO Software: Thesis Concentration
class, but captures only those features that are necessary for V&V. The MtSS and MgSS represents the metho d interactions, i.e. the dynamic interactions b etween the class instances. The MtSS and MgSS can b e easily incorp orated as a part of many OO analysis and design techniques to capture the sequence sp eci cation. It is also p ossible to derive the sequence sp eci cation from OO analysis and design pro ducts. We rst discuss a technique of deriving MtSS of a class from the corresp onding state based OO design. We then discuss the derivation of MtSS and MgSS from other well-known dynamic mo dels built during design such as ob ject diagram[12], event trace diagram[66], or use-case diagrams [37]. The imp ortance of sp eci cation Consistency and Completeness (C&C) is well-known in software engineering. Inconsistency and incompleteness in sequence sp eci cation would lead to faulty ver- i cation and therefore, C&C of the sp eci cation is essential for developing OO systems with less faults. Since MtSS and MgSS is derived using the analysis and design pro ducts of the OO system, inconsistency and incompleteness identi ed in MtSS and MgSS can b e re ected back to the analy- sis and design pro ducts. Thus, C&C of MtSS and MgSS help in identifying faults in the analysis and design. In this thesis, we provide rules for checking the consistency of MtSS and MgSS in the presence of single and multiple inheritance. We then extend the rules to check the consistency and completeness in the presence of multiple interfaces to a class. An implementation of a OO design must comply with the design. Since implementation from design is a manual pro cess, several faults can b e intro duced in OO implementation. In this thesis, we prop ose several testing techniques to identify faults in the implementation. We prop ose b oth static and dynamic testing techniques. The data ow anomaly testing is the static testing metho d that uses the MtSS and OO source program of an implementation to identify data ow anomalies in the implementation. The dynamic testing techniques include random, partition, data ow, and scenario based testing. We discuss ab out generating test cases from single class, several classes, and
state-transition diagram of the class instances. An implementation of a design might not completely comply with the MtSS of the class. Further, testing of an implementation might not reveal all the out-of-sequence messages to instances of a class. In this thesis, we prop ose a run-time veri cation system that checks for the consistency of messages received at each ob ject with resp ect to its sequence sp eci cation and ags out out-of-sequence messages. A supp ort for run-time veri cation is very essential in safety-critical systems[53]. Research in V&V of OO systems will continue to intro duce new testing techniques for OO systems. These testing techniques vary in their e ectiveness, robustness, and cost. In this thesis, we prop ose a testing technique evaluation metho dology based on life cycle mutation testing. This evaluation scheme facilitates the evaluation of various testing techniques. The life cycle mutation testing is indep endent of a development paradigm. This evaluation metho dology has b een used and evaluated with resp ect to several of the ab ove testing techniques in the context of exp ert system testing and is found to b e e ective. In the rest of this chapter we discuss ab out OO as well as V&V related concepts.
1.1 Ob ject-Oriented Concepts
In OO mo del, the fundamental entities are ob jects compared to pro cedures and functions in im- p erative programming languages. Ob jects send messages to other ob jects, execute a metho d when a message is received from other ob ject, and maintain an encapsulated lo cal state. In an ob ject- oriented program a functionality is implemented by sending and receiving messages b etween ob jects. In this section, we review the concept of ob jects, interaction b etween ob jects, classes, and inheri- tance.
An ob ject encomp oses state and behavior. The state of an ob ject is determined by a set of attributes and their values. The b ehavior of an ob ject is de ned by a set of metho ds (op erations) of the ob ject. Metho ds are an abstraction of pro cedures and functions. An ob ject encapsulates its state and only the metho ds of the ob ject can refer or mo dify the state of the ob ject. Messages are requests sent from one ob ject to other for computing a desired functionality. Meth- ods are the functions an ob ject executes in resp onse to a message. There exists a one-to-one relation b etween the messages an ob ject receives and the metho d it executes [76]. A metho d b efore sending a message to other ob ject, must uniquely identify the other ob ject. In addition, an ob ject accessing the services of other ob jects must know the prop er interface proto col of the ob jects. The instance metho ds of a class can b e classi ed into de ne, use, or de ne-use typ e. The de ne typ e metho ds change ob ject state by mo difying the attribute contents. The use typ e metho ds (also known as implementor metho ds) access the current values of attributes. The de ne-use typ e metho d uses as well as changes the contents of attributes[45]. The ob jects in a system are created during execution time.
Classes describ e a common b ehavior of a group of unique ob jects. A class is a static description of a set of ob jects. A class describ es all the instance metho ds and attributes. During execution,
classes, and depiction of logical as well as physical mo dels of ob ject and class interaction. Even though in OO paradigm it is p ossible to concurrently p erform analysis, design and implementation of classes, each class is develop ed sequentially [17]. Early C&C of designed classes help in the detection of contradictions and gaps and thus promote reliable implementation.
From the software engineering life-cycle p ersp ective, it is advo cated to design systems that are mo d- ular and well encapsulated. It is often preferred to design a system that abstracts and mimics the actual problem domain. Further, a design must b e done with divide-and-conquer principle. In ad- dition, explicit traceability b etween analysis and design pro ducts are essential during maintenance. The OO paradigm supp orts most of the ab ove principles in its notation and thus facilitates de- velopment of mo dular and well-encapsulated applications. In OO paradigm, the problem domain ob jects are re ned in design and are then implemented providing an explicit traceability. The lan- guages used for implementing OO based applications supp ort most of the ab ove principles and foster development of complex reusable applications. The OO paradigm is new and most of the design techniques are not still engineered as a stable and reliable metho d for software development. The basic mo de of functioning in OO based application is by message passing. As each of the metho d p erforms very little, most of the work is done by various metho d executions contained in di erent ob jects. Further, the state of the application is distributed and encapsulated in di erent ob jects. Thus, to get a prop er understanding, testing, and debugging of the system, tracing of the metho ds and messages is essential.
1.2 Testing Concepts
It has b een rep orted that to bring out a pro duction quality software, testing related activities consume at least half of the lab or[9, 78 ]. The primary goal of software testing is to ensure that the end pro duct under investigation is in conformance with the pro duct from which the end pro duct was built. In this section, we intro duce various concepts in testing and discuss with resp ect to OO paradigm. In this pap er we adopt the IEEE standard terminology of error, fault, and failure. According to this terminology errors represent human mistakes which can result in faults in a system. The execution of a faulty system pro duces failures [56]. A fault (or commonly referred to as bug) may cause a system to fail on multiple inputs, but each failure can p otentially lead to the discovery of a new fault. Thus, multiple failures of a system do not necessarily imply that the system has multiple faults. The purp ose of testing is to nd faults in system, thus we are interested in nding minimum numb er of test cases that can pro duce maximum numb er of failures in the concerned system to achieve a desired level of reliability. Veri cation and Validation are commonly used for testing. Veri cation usually refers to those activities that ensure that the current stage in software development is correctly built with resp ect to previous stage. Validation refers to those activities that ensure that the current stage in software development is correctly built with resp ect to the original requirements. A sp eci cation is complete when all the required comp onents are present and completely develop ed [10]. A sp eci cation is consistent if its comp onents do es not con ict with each other [10]. Consistency and Completeness of sp eci cation is inter-related and often inconsistency leads to incompleteness and vice-versa.
Figure 1.4: The conventional software development paradigm
What constitutes \testing" for a software system is closely tied to the paradigm used for its devel- opment. Development paradigms for conventional software, for example, include several variants of the Waterfall mo del [65] (e.g., the Spiral mo del [11]). In this class of mo dels, testing (generally referred to as veri cation and validation [57, 6 , 61 ]) establishes a binary relationship b etween two by-pro ducts of the software development pro cess. For example, one typ e of binary testing compari- son is b etween a sp eci cation (a description of the problem to b e solved) and a design do cument (a description of the functional decomp osition, data structures and algorithms) [10]. The OO development paradigm can b e mapp ed to Spiral mo del of software development. Thus, testing in OO paradigm can b e similarly de ned as a metho d of establishing a binary relationship b etween two by-pro ducts of the software development such as b etween analysis and design or b etween design and implementation. In the following, we discuss the reasons for testing b eing hard. We then discuss testing related issues with resp ect to OO paradigm.
Testing in general is a lab or-intensive and fault-prone pro cess [57]. Testing generally consists of the following distinct steps.
The ab ove steps are very much applicable in OO paradigm. The diculties asso ciated with each step of testing describ ed ab ove arise from unclear testing criteria, large input and output spaces, and in generation of legal test cases.
Unclear testing criteria
Testing criteria de ne the goals for comparing a system against a sp eci cation. Black-box compar- isons are based on the input and output alone without any consideration of, for example, \how" the system solves the problem sp eci ed in the problem sp eci cation [57]. White-box comparisons, on the other hand, use prop erties of the solution pro cess of the system (such as a line of reasoning) as a comparison criteria [57]. Some imp ortant testing criteria are:
System No. of Attributes Size of Size of ob jects input space output space MYCIN 17 257 3.4 x 106 6 x 106 INTERNIST 571 4100 4.0 x 10169 3.1 x 107 XCON 94 840 3.5 x 1029 2.1 x 10276 XSEL 79 329 5.0 x 1024 - XFL 74 252 1.3 x 1023 -
Table 1.1: Sizes of p ossible input and output spaces (from Buchanan-88)
Table 1.2: Diculties in generating test inputs.
and output test cases that satisfy testing criteria from these huge input and output spaces can b e dicult. The input and output space for generating test cases are huge even in OO paradigm. The path space from which test paths need to b e selected is also huge.
Generation of test case input is dicult
A legal test input is a test input that is consistent with the input sp eci cation in the problem sp ec- i cation or requirements do cument. When p ossible input and output spaces are large, determining legal inputs and outputs may b e dicult. Although a problem sp eci cation may sp ecify what a legal test input is, it is generally dicult to sp ecify how it can b e generated. As table 1.2 shows it is almost imp ossible to e ectively generate a test input when problem sp eci cation do es not sp ecify the de nition of a legal input. If the problem sp eci cation sp eci es the legality criteria, an oracle can b e used to identify the legal test inputs. For example, the input part of a test case can b e generated by an exp ert (if she is available). Similarly, large numb er of archived test cases can b e used to generate b oth legal inputs and exp ected outputs (e.g., in the case of a medical data base). Textb o oks and domain literature may also b e used to generate p otential inputs. If there is no oracle, it is almost imp ossible to systematically generate a test input.
Table 1.3: Diculties in generating exp ected test outputs
Since validation of a software system requires a large numb er of test cases, generation of exp ected outputs for a legal input can b e exp ensive. For black-b ox testing, the exp ected output consists of an output for a given set of inputs. Domain exp erts can b e used as oracles to generate exp ected outputs for a given set of inputs. If domain exp erts are not available, exp ected outputs can b e generated from other sources such as an explicit solution sp eci cation or design, archived test cases, text b o oks or domain literature. The generation of outputs from these sources, however, will in general b e dicult. The generation of exp ected outputs from arbitrary inputs can only b e established in simple cases. The diculties for generating exp ected outputs are similar to those for test case input and are summarized in table 1.3. In white-b ox testing we need to trace paths through the software system in addition to compar- ing inputs and exp ected outputs. Usually, there exists a large numb er of paths through a software system. For example, in MYCIN [24] it is estimated that the minimum numb er of paths is approx- imately 250,000. Given a legal test case input, the generation of an exp ected path from the large set of p ossible paths is not obvious. Unlike exp ected output, path information is not available in archived test cases, text b o oks and domain literature. This problem of generating path based test cases is more prevalent in OO paradigm.
Summary
Testing is dicult b ecause the input and output spaces of software systems are usually large and generation of legal input and exp ected output is dicult and often not obvious. In practice, how- ever, the numb er of test cases actually required to achieve a high degree of reliability is small in prop ortion to the size of p ossible input and the output spaces. This apparent discrepancy b etween the astronomical size of the input and the output space and the numb er of test cases required to achieve high reliability is interesting. Although the p ossible size of the p otential input and output spaces may b e large for conventional software in most cases the numb er of test cases required to establish high reliability is small when compared to the size of p ossible input and output spaces. The key to e ective testing, therefore, is the strategy for generating appropriate sets of test cases.
in [57] that the probability of the existence of more faults in a section of a program is prop ortional to the numb er of faults already found in that section. Path related testing exploits the internal structure of a program in addition to input and exp ected output. Path related testing metho ds include path based partition testing, cause-e ect graph testing, white-b ox dynamic ow testing, data- ow dynamic testing and ablation testing. In the following we discuss ab out these testing techniques.
Partition testing (path based)
Path based partition testing bases the partition on the path space of a program. Again, for parti- tioning the path space one needs a go o d partitioning criteria. The partitioning of the path space can b e carried out with the help of an explicit solution sp eci cation. The path based partition test- ing is usually limited by the availability of clear solution sp eci cation or design. In OO paradigm, path based partition testing is very much applicable as there are huge numb er of paths through the ob jects. Each of the partitions in partition testing needs to b e sub jected to dynamic ow testing. Dynamic ow testing not only checks for input and exp ected output but also ensures that an appropriate path is taken by the program. The exp ected path is usually generated using design information. The path is compared to the path followed by a software system in arriving at an outcome. This testing is e ective for checking whether the program faithfully follows its design. A disadvantage of this technique is that the e ort is prop ortional to the numb er of paths in the design.
Cause-e ect graph testing
Cause-e ect graph testing uses solution sp eci cation and the implemented solution to generate test cases in an exhaustive fashion. Although this typ e of testing is not feasible for a complete system, it can p oint out ambiguities and incompleteness in subset of solution (or problem) sp eci cations and implementation. The exhaustive nature of this testing makes it particularly e ective for detecting unanticipated side e ects [57]. This typ e of testing can also b e used to demonstrate the quality of the solution sp eci cation. However, for a large software system the cost of cause-e ect testing can b e enormous. A well decomp osed software system can b e more suitable for this typ e of testing. Since in OO the system is decomp osed into a set of ob jects or group of ob jects (clusters), cause-e ect graph testing can b e easily applied in OO paradigm.
Data ow testing
Data ow testing tests for path incompleteness, redundancies and ambiguities in an implementation. In any software system, there can b e several paths that are executed b etween de ne and use of a data value. Data ow testing tests all paths b etween such a de ne-use (DU) pair. There exists di erent variations of data ow testing based on the coverage criteria. The following criteria are commonly employed for testing conventional programs [64, 60 ]
All-c-uses: All the paths from a variable de ne to its use in a calculation.
All-p-uses: All the paths from a variable de ne to its use as a predicate.
All-uses: The union of all the paths derived from All-c-uses and All-p-uses.
All-du-uses: All the lo opless paths b etween a variable de ne and use are considered for testing.
Data ow testing is useful for detecting multiple paths b etween DU pairs. Data ow testing is useful for identifying path related faults. For e ective data ow testing however, due to the complexity of the implementation, additional reverse engineering to ols may b e required. Like other path based techniques the cost of this technique is prop ortional to the numb er of DU-pair paths. Data ow testing can b e easily employed for testing OO programs. Data ows exist b etween the metho ds of the same class and data ow test cases can b e generated from them. Data ows also exist b etween metho ds of di erent classes. The instance variables which participate in data ows can b e used for computation, for holding ob jects, or as a predicate.
Life-cycle testing
Life cycle testing addresses issues like when to stop testing (reliability testing), whether existing test cases are sucient to detect certain kinds of faults (mutation testing), or whether an old feature has b een changed during software maintenance (auto-regression testing). Auto-regression testing has b een used extensively in industry to maintain and conventional software[3]. Reliability tests can also b e used in conjunction with mutation to evaluate b oth black-b ox and white-b ox testing metho ds. In this section we discuss reliability testing. As discussed in section 1.2.2 the size of input space of an exp ert system is huge. Because it is not p ossible to exhaustively test such a space, only a small p ortion of the test cases has to b e tested. One metho d for estimating an appropriate numb er of test cases at AT&T is given in [43]. If Pt is the desired quality level (for example, 80% accuracy) and ns are the numb er of test cases in a test suite, the upp er (P s^ + ) and lower (P s^ ) 95 - p ercentile con dence levels are given by, P s^ + = Ps + (^1) n:^960 : 5 s , P s^ = Ps (^1) n:^960 : 5 s and = [Ps (1 Ps )]^0 :^5
where is the variance of pass-rate and has a maximum value of 50 p ercent. Ps , the pass-rate is recomputed after running each test case. The crossing p oint of P s^ + and Pt determines the numb er of test cases required for achieving the required quality of testing. The techniques rep orted in [43] assume that test samples are homogeneous and test results follow a binomial distribution. It is not clear that any software can completely satisfy these assumptions. However, reliability mo dels such as this can provide at least pragmatic hints for practicing engineers[4, 5] concerned with the reliability of software with resp ect to certain testing techniques.
1.3 Related Research in OO Testing
In recent years, several techniques have b een prop osed for analysis, design, and implementation of OO software. A recent survey article [54] mentions more than twenty OO analysis and design techniques. The survey article provides a comparative evaluation of these techniques. But, none of these prop osed techniques explicitly address the V&V related issues in analysis, design, and implementation. Meyer, in his research on 'design by contract' provides a rigorous usage of pre- conditions, p ost-conditions, and invariants for sp ecifying and implementing metho ds of a class [51, 52 ]. An excellent intro duction to multiple interfaces for classes is given in [29]. OO paradigm b eing a new eld, not much research has b een done in V&V of OO programs. Ma jority of the research is in the initial stages of de ning the issues related to V&V of OO [8]. We can classify the testing related research into (1) intro ductory and de nition of issues in OO