POTD 5: Data flow graph coverage for source code

Due 16-Oct-2025, 11am EST
Purpose:

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 Java method

public static List<String> fizzBuzz(int n) 
{
   var answer = new ArrayList();
   for (int i = 1; i <= n; i++) 
   {
      if (i % 2 == 0 && i % 3 == 0)
         answer.add("FizzBuzz");
      else if (i % 2 == 0)
         answer.add("Fizz");
      else if (i % 3 == 0)
         answer.add("Buzz");
      else
         answer.add(Integer.toString(i));
   }
   return answer;
} 
  1. Draw a Control Flow Graph for the fizzBuzz method Annotate all information (i.e., source code, defs and uses).
  2. List all du-pairs, then derive du-paths (the du-paths then can be used as test requirements)
    DU-pairs DU-paths
       
  3. Apply All-Defs coverage to design tests
    Test requirements Test paths Test cases (input values and expected output)
         
  4. Apply All-Uses coverage to design tests
    Test requirements Test paths Test cases (input values and expected output)
         
  5. Apply All-DU-Paths coverage to design tests
    Test requirements Test paths Test cases (input values and expected output)
         
    
            

Grading rubric

[Total: 10 points]: Done (or provide evidence of your attempt, full or reasonable effort)

(-2.5 points) for 24 hours late (submitted after 16-Oct-2025 11am EST, by 17-Oct-2025 11am EST)
(-5 points) for 48 hours late (submitted after 17-Oct-2025 11am EST, by 18-Oct-2025 11am EST)


++++++++++++++++++++++++++++++++++++++++++++

Submission

Making your submission available to instructor and course staff is your responsibility; if we cannot access or open your file, you will not get credit. Be sure to test access to your file before the due date.


Copyright © 2025 Upsorn Praphamontripong
Released under the Creative Commons License CC-BY-NC-SA 4.0 license.
Last updated 2025-10-05 9:18