TACCLE: A Methodology for ObjectOriented Software Testing at the Class and Cluster Levels - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

TACCLE: A Methodology for ObjectOriented Software Testing at the Class and Cluster Levels

Description:

Construct a state-transition diagram based in the specification ... Construct object Osender by running a sequence of operation ... – PowerPoint PPT presentation

Number of Views:146
Avg rating:3.0/5.0
Slides: 25
Provided by: salmosa
Category:

less

Transcript and Presenter's Notes

Title: TACCLE: A Methodology for ObjectOriented Software Testing at the Class and Cluster Levels


1
TACCLE A Methodology for Object-Oriented
Software Testing at the Class and Cluster Levels
ACM TOSEM 2001 H. Y. Chen, T. H. Tse and T. Y.
Chen
  • 2002 / 7 / 2
  • Heui-Seok Seo

2
Contents
  • Introduction
  • Class Level Testing
  • Algebraic Specification
  • Definitions of Term Equivalence
  • Testing with Equivalent Terms
  • Testing with Nonequivalence Terms
  • Cluster Level Testing
  • Contract Specification
  • Testing for Message Passing
  • Conclusion

3
Introduction (1/2)
  • Testing Levels in OO Software
  • Algorithmic Level
  • The code for each operation (method) in a class
  • Class Level
  • The interactions of methods and data that are
    encapsulated within a given class
  • Cluster Level
  • The interactions among cooperating classes, which
    are grouped to accomplish some tasks
  • System Level
  • All the clusters

4
Introduction (2/2)
  • OO Testing
  • Testing at the algorithmic and system levels
  • It is similar to conventional program testing
  • Testing at the class and cluster levels
  • There is no predefined execution order in the
    class level
  • Relatively little study has been made on
    cluster-level testing
  • TACCLE (Testing At the Class and Cluster LEvels)
  • Class Level Testing
  • Using algebraic specification
  • Cluster Level Testing
  • Using contract specification

5
Overview of Class Level Testing
  • If (1) is equivalent then (2) is equivalent
    TOSEM 98
  • If (1) is nonequivalent then (2) is nonequivalent

6
Algebraic Specification (1/3)
  • Example of Algebraic Specification

7
Algebraic Specification (2/3)
  • Terminology for Operations
  • Creator
  • Return initial object of class
  • e.g. new
  • Constructor
  • Transform the states of the object and cannot be
    eliminated from a term by applying any rewriting
    rule
  • e.g. _.push(N)
  • Transformer
  • Transform the states of the object but can be
    eliminated from a term by applying rewriting
    rules
  • e.g. _.pop
  • Observer
  • Return the values of the attributes of the object
  • e.g. _.isEmpty, _.top

8
Algebraic Specification (3/3)
  • Terminology for Sequences of Operations
  • Term
  • A sequence of operations
  • e.g. new.push(N).push(20),pop
  • Ground Term
  • Term without variables (and with actual data)
  • e.g. new.push(10).push(20).pop
  • Normal Ground Term
  • Term which cannot be transformed by any axiom
  • e.g. (new.push(10).push(20).pop ? new.push(10))
  • Observable Context on a class C
  • Sequence of constructors or transformer followed
    by an observer of a class C
  • e.g. push(10).push(20).pop.top

9
Definitions of Equivalence (1/3)
  • Rewriting Relations (u1 ? u2)
  • For two terms u1 and u2, u1 can be transformed
    into u2 using the axioms
  • Normal Equivalence (u1 nor u2)
  • u1 and u2 can be transformed into the same normal
    form
  • Observational Equivalence (u1 obs u2)
  • For any observable context oc in the class C,
    u1.oc and u2.oc are observationally equivalent
  • Attributive Equivalence (u1 att u2)
  • For any observer ob in the class C, u1.ob and
    u2.ob are observationally equivalent

10
Definitions of Equivalence (2/3)
  • Subsumption Relation for Equivalence

11
Definitions of Equivalence (3/3)
  • Examples
  • (Normal Equivalence) ? ?(Rewriting Relation)
  • u1 new.push(10).push(20).pop
  • u2 new.push(30).pop.push(10)
  • (Observational Equivalence) ? ?(Normal
    Equivalence)
  • u1 new(John).credit(1000).debit(200)
  • u2 new(John).credit(800)
  • There is not the axiom A.credit(N).debit(M) ?
    A.credit(N-M)
  • (Attributive Equivalence) ? ?(Observational
    Equivalence)
  • u1 new.push(10).push(20)
  • u2 new.push(30).push(20)

12
Testing with Equivalence (1/2)
  • Equivalence Criterion
  • For any observationally equivalent ground term u1
    and u2, ? (u1) and ? (u2) must be
    observationally equivalent
  • ? (u) denote the object produced by the method
    sequence corresponding to a ground term u

13
Testing with Equivalence (2/2)
  • Test Cases Generation
  • Test Case
  • Fundamental fairs which are transformed from the
    same normal form
  • Generation Algorithm
  • Construct all patterns of normal forms from the
    creators and constructors
  • S new.push(N0)
  • For each axioms, replace each occurrence of
    variables with these patterns
  • a4 S.push(N).pop S
  • new.push(N0).push(N).pop new.push(N0)
  • Randomly select an element from subdomains
  • new.push(10).push(20).pop new.push(10)

14
Definitions of Nonequivalence
  • Subsumption Relation for Nonequivalence

15
Testing with Nonequivalence (1/2)
  • Nonequivalence Criterion
  • For any observationally nonequivalent ground term
    u1 and u2, ? (u1) and ? (u2) must be
    observationally nonequivalent

u1 and u2 Attributive Nonequivalence Attributiv
e Nonequivalence Observational Nonequivalence
? (u1) and ? (u2) Attributive
Nonequivalence Observational Nonequivalence
16
Testing with Nonequivalence (2/2)
  • Test Cases Generation
  • Test Cases
  • Attributively nonequivalent ground terms
  • Generation Algorithm
  • Construct a state-transition diagram based in the
    specification
  • For each node ni, find a path pi from the initial
    node n0 to ni
  • n0 Initial Node
  • ni nodes in state-transition diagram (i 1 ..
    k)
  • Take the k(k-1)/2 pairs of attributively
    nonequivalent terms (ui, uj)
  • Two terms corresponding to two paths from node n0
    to the different nodes ni and nj must be
    attributively nonequivalent

17
Nonequivalence Testing Example (1/3)
  • Given Specification and Implementation
  • Axioms in Algebraic Specification
  • a1 S.push(N).height S.height 1 if S.height
    lt 10
  • a2 S.push(N).top N if S.height lt 10
  • a3 S.push(N) S if S.height 10
  • a4 S.push(N).pop S if S.height lt 10
  • Implementation
  • Stack with size 9

18
Nonequivalence Testing Example (2/3)
  • State-Transition Diagram

Initial Node
push
new
push
push
empty true top nil ht 0
empty false top ? 0 ht 10
empty false top ? 0 1 ? ht ? 9
pop
pop
pop
19
Nonequivalence Testing Example (3/3)
  • Attributively Nonequivalent Ground Terms
  • u1 new
  • u21 new.push(1)
  • u29 new.push(1).push(2)push(9)
  • u3 new.push(1).push(2)push(9).push(10)
  • Test Cases
  • (u1, u21), (u1, u29), (u1, u3), (u21, u3), (u29,
    u3)
  • Test Results
  • ? (u29) and ? (u3) are attributively equivalent
  • ? (u29) (1,2,,9, 9)
  • ? (u3) (1,2,,9, 9)

20
Overview of Cluster Level Testing
21
Contract Specification
  • Example of Contract Specification

22
Cluster Level Testing
  • Testing for Message Passing
  • Perform class-level testing in the class sender
    and receiver
  • Sender SavingAccount, Receiver CheckAccount
  • Analyze a rule to find the message op(param)
    sent to the object Oreceiver
  • CheckAccount lt- credit(M)
  • Construct an object Orecevier and Pre_Oreceiver
    by running a sequence of operation
  • newCheckAccount(John).credit(1500).writeCheck(10
    00)
  • Construct object Osender by running a sequence of
    operation
  • newSavingAccount(John).credit(2000).debit(300)
  • Run Osender.op(Oreceiver, param) and
    Pre_Oreceiver.op(param)
  • Osav.transferTo(Ochk, M)
  • Pre_Ochk.credit(M)

23
Conclusion and Discussion
  • TACCLE Methodology Using Equivalence
  • Class Level Testing
  • Using equivalent ground terms
  • Using nonequivalent ground terms
  • Cluster Level Testing
  • Automated Tools for TACCLE
  • Testing without Test Oracles
  • Compare two objects resulted from two equivalent
    or nonequivalent sequences
  • Include expected results of tests in test cases
    for the self-test
  • Minimal Probe Effects
  • Use observer operation in the given class

24
Assumption in Algebraic Specification
  • Canonical Specification
  • Every sequences of rewrites on the same ground
    term reaches a unique normal form in a finite
    number of steps
  • Class C with Proper Imports
  • Every oc sequence on C is of finite length and
    can be extended to a primitive oc sequence in a
    finite number of steps
  • Complete Implementation
Write a Comment
User Comments (0)
About PowerShow.com