Your SlideShare is downloading. ×
0
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 betwee...
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 ...
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 ...
Define a Feature - ExampleCreate features/ls.feature
Define ScenariosScenario  Given [D]               D - The initial context  When [E]                E - A user or other     ...
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 - Excepti...
Example
Behat Symfony BundleInstall behat & gherkinInstall behat bundleapp/console -e=test behat --init @AcmeDemoBundleapp/console...
Resourceshttp://docs.behat.org/quick_intro.htmlhttp://dannorth.net/whats-in-a-story/http://symfony.com/video/Paris2011/576...
Upcoming SlideShare
Loading in...5
×

BDD with Behat and Symfony2

5,227

Published on

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

Published in: Technology, Education
1 Comment
7 Likes
Statistics
Notes
  • please add a pdf download option. .key can't easily viewed on other operation systems than mac os
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
5,227
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
58
Comments
1
Likes
7
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript of "BDD with Behat and Symfony2"

    1. 1. Behaviour DrivenDevelopmentTesting with Behat
    2. 2. Kate LanyonBusiness Analyst @ elabor8PHP, Symfony, iOS developerAgency / Start up background@katalisha
    3. 3. Introduction to BDDRequirements & tests in natural languageAdds a structure to Test Driven DevelopmentCollaboration between developers and non-techiesDriven by business value (outside-in)
    4. 4. Writing Tests is Hard What should I test? How should I name this test? What is a unit? Where do I start
    5. 5. Write Behaviours InsteadDescribes a FeatureIncludes ScopeAssists PrioritisationCan be EstimatedCommon definition of“Done”
    6. 6. Example: ATM
    7. 7. Behat: BDD for PHPInspired by Ruby Cucumber & GherkinPHP 5.3Built on Symfony 2 Components Standalone Plugin for symfony 1.4 Bundles for symfony 2
    8. 8. More BehatDefine a featureDefine a scenarioRun tests - failBuild featureRun tests - success
    9. 9. 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
    10. 10. Define a Feature - ExampleCreate features/ls.feature
    11. 11. 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
    12. 12. Define Scenarios - Example
    13. 13. fail
    14. 14. Steps: The Secret SauceCodeRegex to grab test valuesUse any assertion tool (PHPUnit, PHP Exceptions)
    15. 15. StepsAcceptance tests go here in code Passed Pending - BehatBehatExceptionPending Undefined Ambiguous Failed - Exception() Skipped - following a non-passing step
    16. 16. Example
    17. 17. Behat Symfony BundleInstall behat & gherkinInstall behat bundleapp/console -e=test behat --init @AcmeDemoBundleapp/console -e=test behat @AcmeDemoBundleapp/console -e=test behat -dl @AcmeDemoBundle
    18. 18. 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
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×