Object-Oriented Software Testing: Similarities, Differences, and Techniques - Prof. Stephe, Study notes of Engineering

An overview of testing object-oriented software, discussing similarities and differences compared to procedural software, focusing on features such as state-dependent behavior, encapsulation, inheritance, and polymorphism. It also covers testing strategies and techniques for unit and inter-object class testing.

Typology: Study notes

Pre 2010

Uploaded on 03/18/2009

koofers-user-dz6-1
koofers-user-dz6-1 🇺🇸

10 documents

1 / 37

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Testing Object-Oriented
Software (A Brief Overview)
Prepared by
Stephen M. Thebaut, Ph.D.
University of Florida
Software Testing and Verification
Lecture 12
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25

Partial preview of the text

Download Object-Oriented Software Testing: Similarities, Differences, and Techniques - Prof. Stephe and more Study notes Engineering in PDF only on Docsity!

Testing Object-Oriented

Software (A Brief Overview)

Prepared by

Stephen M. Thebaut, Ph.D.

University of Florida

Software Testing and Verification

Lecture 12

Reference:

Software Test and Analysis: Process, Principles, and Techniques

, by Michal

Young and Mauro Pezze. Projectedpublication Spring 2007 by John Wiley& Sons.(Other sources are readily identifiablevia your favorite Internet searchengine.)

Similarities and Differences (cont’d) •

Such features include:^ –

the inherently

state dependent

behavior of methods,

  • encapsulation

of methods and state,

  • inheritance

, and

  • polymorphism

and

run-time binding

of methods.

The impact of these features lessens astesting level increases, however.

Similarities and Differences (cont’d) •

We begin by briefly summarizing theissue(s) and testing related considerationsassociated with each of these features.

Next, we present simple models for unit(object class) and the initial instance ofintegration (inter-object class) testing.

Higher-level testing of object-orientedsystems is basically similar to that of othersystems, and is not considered further.

State Dependent Behavior ofMethods (cont’d) •

Thus, when testing object-orientedsoftware, techniques which assumestateless method behavior should beavoided.

How would one extend the input partitionand combinatorial test case designapproaches considered previously to dealwith state-dependent program behavior?

State Dependent Behavior ofMethods (cont’d) •

Ad-hoc adaptations of these approachesare straightforward when combined withstandard state machine models ofprogram behavior.

We discuss the use of such models whenconsidering object class testing.

Encapsulation of Methods and State(cont’d) • Special instrumentation may be required

to interpret the results of methods thatresult in hidden state changes, or toaccess methods that are themselvesprivate.

Inheritance •

Inheritance is an

abstraction mechanism

that allows object classes to bespecialized or extended from one ormore other object classes.

The resultant child object class

inherits

attributes and methods

from these

ancestor classes, changing some, andadding others.

Inheritance (cont’d) •

In general, testers must determine whennew tests must be designed, when oldtests can be re-run, and when re-testingcan be avoided all together.

Polymorphism and Dynamic Binding •

Many object-oriented languages allow variables types

and

method bindings

to

change dynamically.

For example, when the generic elementsof object class “list” are dynamicallybound to particular types, list operationssuch as “append(value)” will be boundto particular methods.

Object Class Testing •

“Unit testing” of object-oriented softwarenormally focuses on object classes asopposed to individual methods.

Methods often interact in altering objectstate, and their individual behavior can beobscured (due to encapsulation) whenconsidered in isolation.

Therefore, treating individual methods as“units” is usually not practical.

State Machine Models •

State machine models provide a useful meansfor describing object states and transitions.

States can be inferred from descriptions ofmethods that act differently or return differentresults depending on the state of the object.

Input partition and combinatorial test casedesign approaches may be applied on a state-by-state basis.

A Simple Example (cont’d)

Retract

  • Remove the top element

from a stack and return the modifiedstack Is_Empty

  • True if and only if there

are no elements on a stack

A Simple Example (cont’d)

With method signatures: New

Stack

Push (Stack, Elem)

Stack

Top (Stack)

Elem

Retract (Stack)

Stack

Is_Empty (Stack)

Boolean