Bdd and Behat

10
BDD and Behat Get your code acting properly

Transcript of Bdd and Behat

Page 1: Bdd and Behat

BDD and Behat

Get your code acting properly

Page 2: Bdd and Behat

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

Page 3: Bdd and Behat

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

Page 4: Bdd and Behat

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

Page 5: Bdd and Behat

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

Page 6: Bdd and Behat

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

Page 7: Bdd and Behat

Example Step

/*** @Given /^(?:|I )am on "(?P<url>[^"]*)”$/*/public function goTo($url) { $this->browser->open($url);}

Page 8: Bdd and Behat

Why Use BDD

Document features

Better requirements

Know what is broken

Know how to reproduce a failure

Have confidence that your application works

Page 9: Bdd and Behat

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

Page 10: Bdd and Behat

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

[email protected]