Date post: | 30-Jul-2015 |
Category: |
Technology |
Upload: | adam-englander |
View: | 205 times |
Download: | 2 times |
BDD and Behat
Get your code acting properly
Who Am I?
Developer/Evangelist at LaunchKey
Founder/Co-Organizer of Las Vegas PHP UG
Co-Organizer of Las Vegas Developer UG
#vegastech enthusiast
Testanista
Author of phpmachinist-behat-extension
What is BDD?
Behavior Driven Development is developing for required application behavior
BDD utilizes tests who’s result are in a plain language understood by the business
BDD uses Extreme Programming (XP) based features and scenarios to accomplish both goals
Why Use BDD?
BDD tests all the things
BDD only tests what matters
BDD makes it easy to understand what’s not working
BDD documents requirements in the system
What is Behat?
PHP implementation of the Cucumber specification
Uses Gherkin as the Domain Specific Language (DSL) to allow for writing tests in plain language
Uses annotations and regular expressions to match steps with underlying code base
Allows for reusable step code
Example Gherkin
Feature: Home Page
Scenario: Login Link Given I am on the homepage When I click " Login" Then I will be on the "LaunchKey | Log in" page
Example Step
/*** @Given /^(?:|I )am on "(?P<url>[^"]*)”$/*/public function goTo($url) { $this->browser->open($url);}
Why Use BDD
Document features
Better requirements
Know what is broken
Know how to reproduce a failure
Have confidence that your application works
Why Use Behat
Generates skeleton step code
Reusable steps without function knowledge
Mink Extension gives client agnostic browser steps
Framework Extensions for server-free testing
A myriad of other extensions
http://www.slideshare.net/AdamEnglander/bdd-and-behat-47848219
http://spkr8.com/t/58531
http://docs.behat.org/
@adam_englander
#launchkey on freenode.net
#vegastech on freenode.net