Specification by Example
In requirements elicitation and elaboration, we have identified the related concepts of user stories and TDD examples.
The general ideas underlying this approach are shared by a set of methodologies known by several different terms.
- Specification By Example
- Note: the focus on examples as the "single source of truth".
- Common language understood by:
- Customers and other stakeholders
- Business analysts
- Software developers
- See also | Martin Fowler's remarks on Specification by Example
- Behaviour-Driven Development
- TDD Examples == Acceptance Criteria == Scenarios
- Acceptance Test-Driven Development
- Note: the structured template layout for acceptance criteria.
- StoryTest-Driven Development
- Acceptance test examples are further formalized into StoryTests.
- Programmers implement fixtures which automate acceptance tests.
- The Fit framework allows this approach to acceptance testing to be highly automated.
Critique
- Specification by example does not satisfy the requirements for a complete and correct system specification.
- Only a small subset of input-output mappings are defined.
- Examples are not mathematically defined and therefore not subject to mathematical proof techniques.
Iteration 4 Specification-By-Example
- Refine TDD examples into human testable concrete form, following the Given-When-Then patterns.
- Create test demos for 5 of your TDD examples.
- One "before" screenshot satisfying the "Given" condition.
- A description of the specific user action satisfying the "When" condition.
- One "after" screenshot satisfying the "Then" condition.
- Example: listening comprehension mode scenarios/TDD examples.
- Scenario 1
- Given: that listening comprehension mode is enabled
- When: the user initiates a new puzzle
- Then: the user sees a standard Sudoku grid with some prefilled cells showing digits in the range 1..9 and all other cells empty
- Scenario 2
- Given: that the user is filling in the grid in listening comprehension mode,
- and that the grid includes a cell with the prefilled digit 4
- and that word pair 4 is (green, vert)
- When: the user presses the prefilled cell having the digit 4
- Then: the user hears the word "vert" read out and pronounced in French.
- Given: that the user is filling in the grid in listening comprehension mode,
- Scenario 3
- Given: that the user is filling in the grid in listening comprehension mode,
- and that the grid includes a cell with the prefilled digit 4
- and that word pair 4 is (green, vert)
- When: the user selects a non-prefilled cell to enter the word "green"
- Then: the word "green" appears in the list of words that may be selected, but not in the fourth position
- Given: that the user is filling in the grid in listening comprehension mode,
- Scenario 4
- Given: that the user is filling in the grid in listening comprehension mode,
- When: the users presses a cell and hears the word "vert"
- Then: the user does not see the word "vert" anywhere on the game grid.
Updated Mon Nov. 28 2022, 18:35 by cameron.