Prove the Minimum Test Addition

A delivery service returns a promised delivery time in days using the function below. The zone is either "local" or "remote", and express is Boolean. Its current suite contains ("local", True) and ("remote", False).


Python
def dispatch(zone, express):
    if zone == "local":  # D1
        if express:      # D2
            return 1
        return 2
    if express:          # D3
        return 3
    return 5


A zone decision splits execution between two separate express decisions and four return statements.


Count only the true and false exits of D1, D2, and D3 as branch items. Each test calls the function once.


Find both quantities:

  • The minimum number of additional tests required for 100% decision-outcome branch coverage, as an exact integer.
  • The branch coverage if only ("remote", True) is added to the current suite, as a percentage to one decimal place.
Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More White-Box (Glass-Box) Testing Questions: