際際滷

際際滷Share a Scribd company logo
Behaviour Driven  Developmentwith C# & F#Phil Trelford / @ptrelford
BDD with F# at DDDBelfast
Agile ManifestoIndividuals and interactionsover     processes and toolsWorking softwareover     comprehensive documentationCustomer collaborationover     contract negotiationResponding to changeover      following a plan
Collaboration
User Stories
Acceptance TestsRefunded items should be returned to stockGiven  a customer buys a black jumperAnd I have 3 black jumpers left in stockWhen he returns the blackjumper for a refundThen I should have 4 black jumpers in stock
Test Driven Development (TDD)BenefitsFacilitates changeRefactoringRegression TestingDocumentationAPILiving DocumentationDesignClasses, MethodsBehaviour
Unit TestingA good unit test needs both to illustrate and define the behavioural contract of the unit in question. Behaviour is more than just individual methods  KevlinHenney
Behaviour Driven Development(BDD) Is an agile software development technique that encourages collaboration betweenDevelopersQABusiness Participants	in a software project.It extends TDD by writing test cases in a natural language that non-programmers can read.
Behaviour Driven Development (BDD)BenefitsFacilitates ChangeRefactoringRegressionRewritingDocumentationBehaviourLiving DocumentationDomain LanguageDefines DoneWhen all tests pass
Team Workshops
BA + Developer + QA
Testers find holes
BDD FrameworksExternal DSLCuke4NukeNBehaveStorEvilSpecFlowTickSpecInternal DSLMSpecNaturalSpecNSpecSpecsForStoryQ
DeclarationsGherkinGiven I input 5When calculating the factorialThen the result is 120NaturalSpec[<Scenario>] let ``When calculating factorial of 5 it should equal 120``() = Given 5 |> When calculating factorial |> It should equal 120 |> Verify
First Steps in BDD on .Net
Look no hands
Look no hands
TickSpec
Demo
Step away from the toolsStart by having conversations, engaging both testers and business stakeholdersIf you cant have those conversations, stop. You cant do BDD  Liz Keogh
BDD Patterns: TablesScenario: Winning positions	Given a board layout:		| 1 | 2 | 3	|		| O | O | X |		| O |   |   |		| X |   | X |	When a player marks X at middle right	Then X wins
BDD Patterns: ExamplesScenario: Winning positions	Given a board layout:		| 1 | 2 | 3	|		| O | O | X |		| O |   |   |		| X |   | X |	When a player marks X at <row> <col>		Then X winsExamples:	| row    | col    | 	| middle | right  |	| middle | middle |	| bottom | middle |
BDD Books
Lifetime BDD Awards
Q & AOr contact me in confidence:Twitter: @ptrelfordE-mail: phil(at)trelford.comIn-person: http://meetup.com/FSharpLondon

More Related Content

BDD with F# at DDDBelfast

Editor's Notes

  1. http://www.stickyminds.com/sitewide.asp?Function=edetail&amp;ObjectType=ART&amp;ObjectId=13833&amp;tth=DYN&amp;tt=siteemail&amp;iDyn=2Key part here is A good unit test needs to define the behavioural contractThese kind of observations were what prompted Dan North into evolving TDD into BDD, which is what we will discuss next.
  2. This is a description of what BDD is and how it relates to TDD.
  3. BDD also known as Acceptance Test Driven Development etc.