Modal Testing Strategies for Object Oriented Software - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Modal Testing Strategies for Object Oriented Software

Description:

'Characterization of Class behavior difference to indicate appropriate test ... A nonmodal class imposes no constraints on the sequences of messages accepted. ... – PowerPoint PPT presentation

Number of Views:440
Avg rating:3.0/5.0
Slides: 15
Provided by: Ina52
Category:

less

Transcript and Presenter's Notes

Title: Modal Testing Strategies for Object Oriented Software


1
Modal Testing Strategies for Object Oriented
Software

2
Target
  • To design a practical suite that exercises enough
    combination of message sequence and state
    interactions to provide sufficient confidence
  • Challenges
  • Interactions are often subtle
  • Complex --gt Error Prone
  • If classes were alike , it might be enough to
    devise tests based either on message sequence or
    state.
  • Characterization of Class behavior difference to
    indicate appropriate test strategy ? Class
    Modality

3
Class Modality
  • Characterization of Class behavior difference to
    indicate appropriate test strategy
  • Class behavior is an abstraction of the response
    that objects can make to messages.
  • A Response is determined by the content of the
    object or the message , the prior sequences of
    messages accepted , or both.
  • Class Modality is a general pattern of behavior.
  • Modality is determined by the class constraints
    on message sequence and instance variable content

4
Modalities for Testing
  • A nonmodal class imposes no constraints on the
    sequences of messages accepted.
  • Classes that implement relatively simple data
    types are often nonmodal.
  • A unimodal class imposes constraints on message
    sequence, regardless of content.
  • Classes that implement application control are
    typically unimodal.
  • A quasimodal class imposes no constraints on
    message sequence, unless a domain constraint
    does.
  • Many container and collection classes are
    quasimodal.
  • A modal class has both message and domain
    constraints on message sequence.
  • Classes that represents problem domain entities
    are often modal.

5
NonModal Class
  • Consider a class names DateTime
  • It encapsulates a representation of a single date
    and time and provides operation on this
    representation.
  • This class imposes no constraints on the sequence
    of messages accepted . For example
  • An object of DateTime class will accept any
    interleaving of set, get, compareEqual , GetGMT,
    and so on .

6
  • To test this class we define the boundaries of
    the its instance variables.
  • Second 0,59 Minute 0,59 Hour 0,23
  • Day 0, 366 Year 1900, 65363 Zone 1, 24
  • Table 1 shows how domain constraints are used
    with this pattern to generate test points, E
    indicates the Min val, II indicates Max valand
    set of points.

7
UniModal Class
  • Consider class TrafficLight which implements a
    sequential control strategy for a traffic light.
  • Working
  • This class accepts messages that turn on one of
    three lights, but only if the request complies
    with the allowed sequence. If the message is sent
    out of order , the class raises an exception and
    does not change over.
  • This class is Unimodal as an object of
    TrafficLight class can accept the message
    RedLightOn only after accepting a
    YellowLightOn message.

8
Testing
  • Test Plan for TrafficLight has two parts.
  • Conformance Test
  • Sneak Path Test
  • Conformance test are identified by tracing a
    transition tree from the state model.
  • Each root-to-leaf branch is a test case
    consisting of a legal sequences of messages.
  • The state obtained after this sequence must
    conform the state specified.
  • However conformance alone is not sufficient as we
    must ensure that that incorrect sequences are
    rejected by an apprpriate response without
    corrupting state.
  • Sneak Path Testing attempts every illegal message
    in every state.

9
The table shows the conformance and sneak Path
test suite.

10
QuasiModal Class
  • Class Stack bases its response to a message on
    the content of a stack object, not on the last
    message sent.
  • A quasimodal class imposes no constraint on
    message sequence. For example
  • An object of class Stack will reject a push
    message if a stack is full but accept it
    ohterwise.
  • The behavior of a quasimodal class is a result of
    properties and relationships that are independent
    of content ( a full stack if full, regardless of
    the values of the entries that have made it
    full).

11
  • To test stack , we must test each variation of
    sequential constraints caused by variations in
    its domain.
  • The test strategy has three steps
  • Characterize states by constraints ( not by
    content)
  • Apply the vertex probe strategy to the
    parameters.
  • Identify specific values that will result in the
    sequences being exercised.

12
(No Transcript)
13
Modal Class
  • Consider the class Account which is modal as it
    constraints both sequence and contents.
  • Test strategy is Hybrid
  • An N test plan is prepared , providing
    transition and sneak path test coverage,
  • Vertex probe analysis is prepared.
  • Test cases are added if any vertex probe points
    have not been reached by N cover.

14
Summary
  • Each class modality is subject to different kinds
    of faults ? needs a different test strategy.
  • Established domain testing strategies can be
    applied to classes and objects an integral
    wholes.
  • Test points can be interleaved in a sequence that
    will also validate control implementation.
  • Test suites that provide N and vertex coverage
    can be produced by analysis.
Write a Comment
User Comments (0)
About PowerShow.com