SWE 637 Homework 3
Fall 2006
FSMs and Prime Path Coverage: Due 9/26, beginning of class


It would be easier to write papers on testing if you didn't have to contemplate actually using the stuff you are writing.
- Richard Carver

Answer the following questions. Bring hardcopies of your answers to class, hand written or printouts. All homeworks are due before class on the due date. Please remember that the GMU Honor Code is in effect: You may discuss the assignment with each other, the professor, or the GTA, but each homework should be done individually.

Use the class vendingMachine.java from homework 2 to answer the questions below.

  1. (2 pts) Draw a finite state machine (FSM) to represent the behavior of the four methods in vendingMachine (excluding the main() method, that is).
  2. (3 pts) Enumerate the prime paths in your FSM. Be sure to use the definition from the book (definition 2.5 on page 12), that is, maximal simple paths. (Do not use the definitions on the slides.)
  3. (6 pts) Satisfy edge-pair coverage on your FSM.
    1. Create test paths that satisfy edge-pair coverage.
    2. Refine your EPC test paths into test inputs for the program.
    3. Run your EPC tests and report the results.
  4. (6 pts) Satisfy prime path coverage on your FSM.
    1. Create test paths that satisfy prime path coverage.
    2. Refine your PPC test paths into test inputs for the program.
    3. Run your PPC tests and report the results.
  5. (3 pts) How much difference do you see in the two sets of tests?