Data Flow Testing - PowerPoint PPT Presentation

About This Presentation
Title:

Data Flow Testing

Description:

Data Flow Testing Define/Use Testing Winter 2006 Presented by Nikos Giannopoulos nikos_at_swen.uwaterloo.ca – PowerPoint PPT presentation

Number of Views:128
Avg rating:3.0/5.0
Slides: 21
Provided by: softlabNt
Category:

less

Transcript and Presenter's Notes

Title: Data Flow Testing


1
Data Flow Testing Define/Use Testing Winter 2006
Presented by Nikos Giannopoulos nikos_at_swen.uwaterl
oo.ca
2
Agenda
  • Define/Use Testing Definitions
  • Define/Use Testing Example
  • Commission Problem
  • DU-Path Test Coverage Metrics

3
Agenda
  • Define/Use Testing Definitions
  • Define/Use Testing Example
  • Commission Problem
  • DU-Path Test Coverage Metrics

4
Define/Use Testing Definitions
  • Node is a defining node of the
    variable , written as DEF(v,n), iff the
    value of the variable v is defined at the
    statement fragment corresponding to node n
  • Node is a usage node of the
    variable , written as USE(v,n), iff the
    value of the variable v is used at the statement
    fragment corresponding to node n
  • A usage node USE(v,n) is a predicate use (denoted
    as P-use, outdegree 2) iff the statement n is a
    predicate statement otherwise USE(v,n) is a
    computation use (denoted C-use, outdegree 1)

5
Define/Use Testing Definitions
  • A definition-use (sub)path with respect to a
    variable v (denoted du-path) is a (sub)path in
    PATHS(P) such that, for some , there
    are define and use nodes DEF(v,m) and USE(v,n)
    such that m and n are the initial and final nodes
    of the (sub)path
  • A definition-clear (sub)path with respect to a
    variable v (denoted dc-path) is a definition-use
    (sub)path in PATHS(P) with initial and final
    nodes DEF(v,m) and USE(v,n) such that no other
    node in the (sub)path is a defining node of v
  • DU-paths that are not definition-clear are
    potential trouble paths

6
Agenda
  • Define/Use Testing Definitions
  • Define/Use Testing Example
  • Commission Problem
  • DU-Path Test Coverage Metrics

7
Define/Use Testing Example
  • Commission Problem
  • Computes the commission on the sales of four
    salespersons based on the total number of locks,
    stocks and barrels sold by each one of them

8
Define/Use Testing Example
9
Define/Use Testing Example
10
Define/Use Testing Example
11
Define/Use Testing Example
  • We use the defining and usage nodes in
    conjunction with the program graph to identify
    various definition-use and definition-clear paths
  • Its a judgment call whether or not
    non-executable statements such as constant
    (CONST) and variable (VAR) declaration statements
    should be considered as defining nodes

12
Define/Use Testing Example
13
Define/Use Testing Example
DU-paths such as lt26,26gt are disallowed
14
Agenda
  • Define/Use Testing Definitions
  • Define/Use Testing Example
  • Commission Problem
  • DU-Path Test Coverage Metrics

15
DU-Path Test Coverage Metrics
  • The set T satisfies the All-Defs criterion for
    the program P iff for every variable , T
    contains definition clear (sub)paths from every
    defining node of v to a use of v
  • The set T satisfies the All-Uses criterion for
    the program P iff for every variable , T
    contains definition-clear (sub)paths from every
    defining node of v to every use of v, and to the
    successor node of each USE(v,n)
  • The set T satisfies the All-P-Uses/Some C-Uses
    criterion for the program P iff for every
    variable , T contains definition-clear
    (sub)paths from every defining node of v to every
    predicate use of v, and if a definition of v has
    no P-uses, there is a definition-clear path to at
    least one computation use

16
DU-Path Test Coverage Metrics
  • The set T satisfies the All-C-Uses/Some P-Uses
    criterion for the program P iff for every
    variable , T contains definition-clear
    (sub)paths from every defining node of v to every
    computation use of v, and if a definition of v
    has no C-uses, there is a definition-clear path
    to at least one predicate use
  • The set T satisfies the All-DU-paths criterion
    for the program P iff for every variable ,
    T contains definition-clear (sub)paths from every
    defining node of v to every use of v, and to the
    successor node of each USE(v,n), and that these
    paths are either single loop traversals, or they
    are cycle free

17
DU-Path Test Coverage Metrics
  • Example All-Uses criterion wrt locks
  • All-C-Uses
  • lt22,26gt, lt29,26gt
  • All-P-Uses
  • lt22,23gt, lt29,23gt
  • All-Uses All-C-Uses Union All-P-Uses
  • lt22,26gt, lt29,26gt, lt22,23gt, lt29,23gt

18
DU-Path Test Coverage Metrics
  • When one test coverage metric subsumes another, a
    set of test cases that attains coverage in terms
    of the first metric necessarily attains coverage
    with respect to the subsumed metric
  • Since several du-paths are present in a full
    program execution path (traversed by a test
    case), the higher forms of coverage metrics dont
    always imply significantly higher numbers of test
    cases
  • The missing du-paths (8, 9, 14, 18, 19) are all
    traversed by a test case in which nothing is sold
    (i.e., the first value of locks is -1)

19
Agenda
  • Define/Use Testing Definitions
  • Define/Use Testing Example
  • Commission Problem
  • DU-Path Test Coverage Metrics

20
References
  • Software Testing A Craftsman's Approach 2nd
    edition, Paul C. Jorgensen, CRC Press (Chapter 10
    (10.1))
Write a Comment
User Comments (0)
About PowerShow.com