Testing We know we should do it, why don't we? ● It takes too much time ● It slows me down ● The boss won't let me ● I'm not really sure how
Testing 1.Write code 2.Write tests ● The test is written to match code ● It carries the bias of our code ● Its just too much trouble
TDD Solution: Test Driven Development
TDD Test written before code ● Eliminates bias ● You know the test will be written
TDD What the hell do I test?
BDD Behavior Driven Development
BDD What makes it different? Its written from the outside in, driven by the business value
BDD How does it work? You tell a story When a customer clicks on a blue widget, it is added to their shopping cart.
BDD Advantages ●Clarifies up front what needs to be done ●It is written in everyday, spoken language ●Anyone can understand and write stories ●Makes everyone think about the requirements ●It keeps you focused on what is necessary - YAGNI
Behat ●System to write and test stories ●Uses Gherkin syntax ●6 step process ●PHP 5.3