3. Introduction to BDD
Requirements & tests in natural language
Adds a structure to Test Driven Development
Collaboration between developers and non-techies
Driven by business value (outside-in)
4. Writing Tests is Hard
What should I test?
How should I name this test?
What is a unit?
Where do I start
7. Behat: BDD for PHP
Inspired by Ruby Cucumber & Gherkin
PHP 5.3
Built on Symfony 2 Components
Standalone
Plugin for symfony 1.4
Bundles for symfony 2
8. More Behat
Define a feature
Define a scenario
Run tests - fail
Build feature
Run tests - success
9. Define a Feature
Feature:
In Order to [A] A - The business value
As a [B] B - The persona
I need to [C] C - Description of
feature
11. Define Scenarios
Scenario
Given [D] D - The initial context
When [E] E - A user or other
event
Then [F]
F - What should
happen (acceptance
criteria)
As many as needed to describe the feature
14. Steps: The Secret Sauce
Code
Regex to grab test values
Use any assertion tool (PHPUnit, PHP Exceptions)
15. Steps
Acceptance tests go here in code
Passed
Pending - BehatBehatExceptionPending
Undefined
Ambiguous
Failed - Exception()
Skipped - following a non-passing step