Background
I am trying to help my team organize for a new mobile app project. We have chosen to follow BDD (see also BDD definition) in order to capture plain English requirements that form a contract between stakeholders and developers for each individual user story.
We use the acceptance tests to document each user story's requirements. Acceptance tests are written before sprint planning. Developers refine and add to the tests during sprint planning.
We define Acceptance Criteria as a list of rules (eg: input validation, default values, etc) and Acceptance Tests as a list of Cucumber scenarios. We plan on using Calabash for mobile testing.
I feel acceptance criteria/tests are a more agile and therefore better solution to more formal requirements documents.
I feel I have found an effective solution fo, but I would like to understand how others are collecting requirements and writing acceptance tests.
Problem
There is a debate in the Cucumber community of imperative vs declarative test steps. I lean toward imperative, because a developer must know what a deliverable user story looks like.
I do not feel UI coupling aka brittle tests is an issue. There are ways to decouple the UI from the test (eg: page objects). I also do not feel that having detailed steps make it hard for a non-technical stakeholder to understand (unless they don't know how to use a web browser or mobile device, but that's a separate issue).
I may be misappropriating the term "Acceptance Test". In my use, an acceptance test is not on the same level of scope as a unit test. I view an acceptance test as a high level integration test.
The Example
- As a guest
- I want to login
- to access app functionality
Imperative Test
- Scenario: Valid login
- Given I am on the "login" screen
- When I enter "[email protected]" in "email"
- And I enter "password1" in "password"
- And I tap "login"
- Then I see "login successful"
Declarative Test
- Scenario: Valid login
- Given I have a valid account
- Then I can login
These both can cover the same functionality and the latter is shorter, but it does not say if I can login with a username, email or facebook/twitter/google/etc account. It's just not enough to actually code a solution
The Question
How do you capture the requirements for a feature with declarative steps?