Activity: Graph: Data flow coverage criteria

(no submission)
Purpose: Understand Defs, Uses, DU-pairs, DU-paths; apply data flow coverage to design tests

You may make a copy of a worksheet and complete this activity, or simply type your answers in any text editor.

You may work alone or with at most two other students in this course.


Consider the following graph and test paths (Ref: AO exercise 7.2.3, Q1, Graph II)

   N  = { 1, 2, 3, 4, 5, 6 }
   N0 = { 1 }
   Nf = { 6 }
   E  = { (1, 2), (2, 3), (2, 6), (3, 4), (3, 5), (4, 5), (5, 2) }
   def(1) = def(3) = use(3) = use(6) = { x }   
   // Assume the use of x in node 3 precedes the def
   
   Test paths
   t1 = [1, 2, 6]
   t2 = [1, 2, 3, 4, 5, 2, 3, 5, 2, 6]
   t3 = [1, 2, 3, 5, 2, 3, 4, 5, 2, 6]
   t4 = [1, 2, 3, 5, 2, 6]  

  1. Draw the graph. Annotate all defs and uses.
    graph for data flow activity
  2. List all of the du-paths with respect to x. (Note: include all du-paths, even those that are subpaths of some other du-paths)
    x has 6 du-paths          
    
    DU-pair DU-path(s)
    (1,3)[1,2,3]
    (1,6)[1,2,6]
    (3,3)[3,5,2,3], [3,4,5,2,3]
    (3,6)[3,5,2,6], [3,4,5,2,6]
    du-paths = { [1,2,3], [1,2,6], [3,5,2,3], [3,4,5,2,3], [3,5,2,6], [3,4,5,2,6] }
  3. Determine which du-paths each test path tours.
    Test path DU-path(s) the test tours (direct) DU-pair(s) the test covers
    t1[1,2,6](1,6)
    t2[1,2,3], [3,4,5,2,3], [3,5,2,6](1,3), (3,3), (3,6)
    t3[1,2,3], [3,4,5,2,6], [3,5,2,3](1,3), (3,3), (3,6)
    t4[1,2,3], [3,5,2,6](1,3), (3,6)
    Note: t2 tours [3,5,2,3] with a detour.
  4. List a minimal test set that satisfies all defs coverage with respect to x (direct tours only). If possible, use the given test paths. If not, provide additional test path(s) to satisfy the criterion.
    This question has multiple possible answers. 
    All test paths use the def in 1, and test paths t2, t3, t4 each use the def in 3. 
    Possible answers: {t2} or {t3} or {t4}
  5. List a minimal test set that satisfies all uses coverage with respect to x (direct tours only). If possible, use the given test paths. If not, provide additional test path(s) to satisfy the criterion.
    This question only has two possible answers. 
    t1 is required for the def in 1 to reach the use in 6. 
    Either t2 or t3 is required for the def in 3 to reach the use in 3. 
    Possible answers: {t1, t2} or {t1, t3}.
  6. List a minimal test set that satisfies all du-paths coverage with respect to x (direct tours only). If possible, use the given test paths. If not, provide additional test path(s) to satisfy the criterion.
    This question has one possible answer: {t1, t2, t3}. 
    t1 is required for path [1,2,6]. 
    t2 is required for path [3,4,5,2,3]. 
    t3 is required for path [3,4,5,2,6] and [3,5,2,3]. 
    Since t1, t2, and t3 together tour all six du-paths, t4 is not needed.



Copyright © 2025 Upsorn Praphamontripong
Released under the Creative Commons License CC-BY-NC-SA 4.0 license.
Last updated 2025-10-04 19:38