Bird
0
0

You have a vending machine with states: Idle, HasMoney, and Dispensing. Events are InsertCoin, SelectItem, and DispenseItem. Which test case best checks the transition from HasMoney to Dispensing?

hard📝 Application Q15 of 15
Testing Fundamentals - Functional Testing Techniques
You have a vending machine with states: Idle, HasMoney, and Dispensing. Events are InsertCoin, SelectItem, and DispenseItem. Which test case best checks the transition from HasMoney to Dispensing?
AStart in Idle, SelectItem, then InsertCoin
BStart in Dispensing, InsertCoin, then SelectItem
CStart in Idle, InsertCoin, then SelectItem
DStart in HasMoney, DispenseItem, then InsertCoin
Step-by-Step Solution
Solution:
  1. Step 1: Identify the transition from HasMoney to Dispensing

    The event that moves the machine from HasMoney to Dispensing is SelectItem.
  2. Step 2: Find the test case that triggers this transition

    Start in Idle, InsertCoin, then SelectItem starts Idle, InsertCoin (moves to HasMoney), then SelectItem (moves to Dispensing), correctly testing the transition.
  3. Final Answer:

    Start in Idle, InsertCoin, then SelectItem -> Option C
  4. Quick Check:

    HasMoney + SelectItem = Dispensing [OK]
Quick Trick: Trace events to reach target transition [OK]
Common Mistakes:
  • Starting in wrong state
  • Using events in wrong order
  • Ignoring correct event for transition

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes