8. Scenario
Scenario: search by city name
Given I am on the homepage
When I fill in "location" with "Christchurch"
And I press "Locate"
Then I should be on the “Store Locator” page
And I should see “Kathmandu Christchurch CBD Re:START”
And I should see “0.2km”
9. Scenario
Scenario: search by city name
Given I am on the homepage
When I fill in "location" with "Christchurch"
And I press “Locate"
Then I should be on the “Store Locator” page
And I should see the following store results:
| name | distance |
| Kathmandu Christchurch CBD Re:START | 0.2km |
| Kathmandu Tower Junction | 2.5km |
1. What is BDD
- Extension of TDD to cover the entire development process
- Associated with agile methodologies
- Encourage a collaborative process with all stakeholders
- Requirements generated by cross-functional teams, BA, developers, tester involved early on - shared understanding
2. "Build the software right", "Build the right software"
- Each proposed feature should have a specific business value that everyone involved buys into
- Examples produced in a standard format that can be understood by everyone
- This is an _executable specifications_
- And living documentation of the behaviour of the system that is PROVEN
3. Language of the spec is often referred to as Gherkin
- Best know through Ruby tool Cucumber
- TDD actually came out of the Java community (JBehave)
- All stories/features refer to a user (persona?) and the business value of the feature to that user
- Stories are the basis for discussion in an iterative process
At least a outline (high level) and number of scenarios (detail of what happens)
Optional narrative and background
2 usual formats for outline
All of these can be extended with “And”
Each line is a “step”
Set up conditions to be executed before each scenario
Beat - PHP version of a suite of tools
Drives the site as a user would. Goutte driver, Selenium or headless for JS
Each line becomes a step in a context file
Executes known steps
Provides outline for any unknown tests
Match regexp
Mink - common web steps and helpers
When a feature fails, if it requires logic, drop down to standard TDD process then back up once green
SS behat extension
- Access SS classes from Behat context
- Set up and reset test database
- YAML fixtures in Behat scenarios
DB
JS/AJAX timing
Slow, especially when driving a browser for JS
Targeting HTML elements - temptation to be too imperative rather than declarative