QuestionQ21

VerifiedTest Analysis and Test Design

You are testing a beverage vending machine. The beverage costs $1. The machine accepts 25c, 50c, and $1 coins. When the total value of inserted coins is equal to or greater than the beverage price, the system dispenses the beverage and returns any change. However, if it cannot dispense change because it lacks coins, or if the user presses Cancel, the system does not dispense the beverage and returns the inserted coins.

You use a keyword-based approach and have the following keywords available.

Question Image

Consider this keyword-based test script used to execute a particular test scenario.

DefineState(1,1,1)  
  
Insert25 -  
  
Cancel -  
  
Insert50 -  
  
Insert50 -  

Which keyword should end this test script?

Explanation

The canceled 25c insertion is returned and does not change the machine’s state. The two 50c coins inserted afterward pay exactly $1, so both remain in the machine. The original $1.75 plus $1.00 equals $2.75.

Community Discussion

No comments yet. Be the first to start the discussion!