• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
BDD with Behat and Symfony2
 

BDD with Behat and Symfony2

on

  • 4,738 views

Quick introduction to the behaviour driven development and the Behat bundle for Symfony 2

Quick introduction to the behaviour driven development and the Behat bundle for Symfony 2

Statistics

Views

Total Views
4,738
Views on SlideShare
4,642
Embed Views
96

Actions

Likes
4
Downloads
47
Comments
1

6 Embeds 96

http://dev.katalisha.com 76
https://twitter.com 10
http://katalisha.com 4
http://www.sfexception.com 2
http://www.sfexception.come 2
http://www.katalisha.com 2

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • please add a pdf download option. .key can't easily viewed on other operation systems than mac os
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

BDD with Behat and Symfony2 BDD with Behat and Symfony2 Presentation Transcript

  • Behaviour DrivenDevelopmentTesting with Behat
  • Kate LanyonBusiness Analyst @ elabor8PHP, Symfony, iOS developerAgency / Start up background@katalisha
  • Introduction to BDDRequirements & tests in natural languageAdds a structure to Test Driven DevelopmentCollaboration between developers and non-techiesDriven by business value (outside-in)
  • Writing Tests is Hard What should I test? How should I name this test? What is a unit? Where do I start
  • Write Behaviours InsteadDescribes a FeatureIncludes ScopeAssists PrioritisationCan be EstimatedCommon definition of“Done”
  • Example: ATM
  • Behat: BDD for PHPInspired by Ruby Cucumber & GherkinPHP 5.3Built on Symfony 2 Components Standalone Plugin for symfony 1.4 Bundles for symfony 2
  • More BehatDefine a featureDefine a scenarioRun tests - failBuild featureRun tests - success
  • Define a FeatureFeature: In Order to [A] A - The business value As a [B] B - The persona I need to [C] C - Description of feature
  • Define a Feature - ExampleCreate features/ls.feature
  • Define ScenariosScenario 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
  • Define Scenarios - Example
  • fail
  • Steps: The Secret SauceCodeRegex to grab test valuesUse any assertion tool (PHPUnit, PHP Exceptions)
  • StepsAcceptance tests go here in code Passed Pending - BehatBehatExceptionPending Undefined Ambiguous Failed - Exception() Skipped - following a non-passing step
  • Example
  • Behat Symfony BundleInstall behat & gherkinInstall behat bundleapp/console -e=test behat --init @AcmeDemoBundleapp/console -e=test behat @AcmeDemoBundleapp/console -e=test behat -dl @AcmeDemoBundle
  • Resourceshttp://docs.behat.org/quick_intro.htmlhttp://dannorth.net/whats-in-a-story/http://symfony.com/video/Paris2011/576http://www.odino.org/378/behaviour-driven-development-in-phphttp://docs.behat.org/cookbook/bdd_in_symfony2_with_behat_mink_and_zombiejs.htmlhttps://github.com/katalisha/behat-tutorial