Your SlideShare is downloading. ×

BDD with Behat and Symfony2

4,822
views

Published on

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

Published in: Technology, Education

1 Comment
6 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
4,822
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
52
Comments
1
Likes
6
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. Behaviour DrivenDevelopmentTesting with Behat
    • 2. Kate LanyonBusiness Analyst @ elabor8PHP, Symfony, iOS developerAgency / Start up background@katalisha
    • 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. Writing Tests is Hard What should I test? How should I name this test? What is a unit? Where do I start
    • 5. Write Behaviours InsteadDescribes a FeatureIncludes ScopeAssists PrioritisationCan be EstimatedCommon definition of“Done”
    • 6. Example: ATM
    • 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. More BehatDefine a featureDefine a scenarioRun tests - failBuild featureRun tests - success
    • 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. Define a Feature - ExampleCreate features/ls.feature
    • 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. Define Scenarios - Example
    • 13. fail
    • 14. Steps: The Secret SauceCodeRegex to grab test valuesUse any assertion tool (PHPUnit, PHP Exceptions)
    • 15. StepsAcceptance tests go here in code Passed Pending - BehatBehatExceptionPending Undefined Ambiguous Failed - Exception() Skipped - following a non-passing step
    • 16. Example
    • 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. 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