2

Analyze the following highly simplified procedure:

Ask: "What type of ticket do you require, single or return?"
IF the customer wants "return"
     Ask: "What rate, Standard or Cheap-day?"
      IF the customer replies "Cheap-day"
           Say: "That will be 11:20"
       ELSE
            Say: "That will be 19:50"
       ENDIF
ELSE
Say: "That will be 9:75"
ENDIF

Now decide the minimum number of tests that are needed to ensure that all the questions have been asked, all combinations have occurred and all replies given.

The answer is 3. Please help with this: why the answer is 3? I do not know to justify.

1
  • What is your argument for the answer being something else than three? What did you answer and why? Aug 3, 2019 at 18:51

3 Answers 3

2

The canonical answer would be 3:

  • "That will be 11:20" will happen only when "return" and "cheap-day" happens.
  • "That will be 19:50" will happen only when "return" and "cheap-day" does not happen.
  • "That will be 9:75" will happen only when "return" does not happen.

However, depending on your context, you may find more situations through exploration:

  • How long will the system wait for an answer?
    • Will this be different on the first and second questions?
  • Answer buffers may cause crashes
  • Internationalization
  • What happens if the input or output devices break?
  • What happens if the system is shutdown during processing or question answering?
  • Etc...

The first set of answer would cover requirement based testing and the second set would come more out of a session of exploratory testing, which is based on risk.

1

The first question has two paths. One of the answers has again two paths. So with three input runs you can cover all paths.

What if the customers answers something different, you will also take the else path in your example?

0

Like Niels said:

  1. Return ticket, Standard -> 11:20
  2. Return ticket, Cheap-day -> 19:50
  3. Single ticket -> 9:75

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.