Specification development – Treasure hunt

As an example for requirement writing, i’d like to create an Application that allows us to do some treasure hunting. Furthermore I’d like to use the Gherkin BDD pattern to write the requriements.

Let’s start with basics, an abstract description of the app as free text and scenarios.

Feature: Treasure Hunt
The player gets some hints or facts to a sight and then gets the task to guess and move to the sight. If the player arrives at his guess, the position can be submitted and is validated if the guess is correct.

Scenario: Asking for new sight
  Given I as a Player
  When Asking for a new sight to guess
  Then I'm offered some facts about the sight to guess

Scenario: Submitting guess
  Given I as a Player
  And I'm given hints for a sight
  And I'm close to the correct sight
  When I submit my position
  Then I'm notified, that it's correct

Cool, we have our first requriements and we also managed to just describe the behavior without digging into solutions like which button to press or how we get and display the facts or even how we get the position.

But what fun would it make if the player always would directly know where to go? We probably need some case, where the player submits some wrong position.

Feature: Treasure Hunt
The player gets some hints or facts to a sight and then gets the task to guess and move to the sight. If the player arrives at his guess, the position can be submitted and is validated if the guess is correct.

@basic
Scenario: Asking for new sight
  Given I as a Player
  When Asking for a new sight to guess
  Then I'm offered some facts about the sight to guess

@basic
Scenario: Submitting guess
  Given I as a Player
  And I'm given hints for a sight
  And I'm close to the correct sight
  When I submit my position
  Then I'm notified, that it's correct

@alternative
Scenario: Submitting wrong guess
  Given I as a Player
  And I'm given hints for a sight
  And I'm not close to the correct sight
  When I submit my position
  Then I'm notified, that it's incorrect

As you see, I already added tags “basic” and “alternative” to the scenarios. That way we can directly see if the scenario is in basic flow or handles some deviation.

Activity diagram

This further detailing can be continued with scenarios for increasing player points, giving up and selecting a new sight or allowing only some amount of wrong guesses.

Also what about adding new sights and facts about them? As we probably don’t want to fiddle with the database directly, we probably need some administrator tool to add and modify.

Feature: Sight maintaining

@basic @admin
Scenario: Add Sights
  Given I as Administrator
  And admin tools
  When sight 'Garden' is not existent
  Then I can add new sight 'Garden'

@basic @admin
Scenario: Add Facts to Sights
  Given I as Administrator
  And admin tools
  And Sights are
    | Name |
    | Berlin Gate |
    | Church |
  When editing sight 'Garden'
  Then I can add new facts to 'Garden'

Leave a Reply

Your email address will not be published. Required fields are marked *