Your SlideShare is downloading. ×
TDD & BDD in F# at Progressive F# Tutorials 2011
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

TDD & BDD in F# at Progressive F# Tutorials 2011

2,648
views

Published on

In this practical session we’ll start by implementing fluent unit tests in F# using FsUnit and NUnit. We’ll then break into teams and develop scenarios in English language to solve a real world …

In this practical session we’ll start by implementing fluent unit tests in F# using FsUnit and NUnit. We’ll then break into teams and develop scenarios in English language to solve a real world scenario and then automate them with the TickSpec library.
Video: http://skillsmatter.com/podcast/scala/tdd-and-bdd
Tasks: http://trelford.com/progfsharp.zip

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,648
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
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
  • http://www.stickyminds.com/sitewide.asp?Function=edetail&ObjectType=ART&ObjectId=13833&tth=DYN&tt=siteemail&iDyn=2Key part here is “A good unit test needs to define the behavioural contract”These kind of observations were what prompted Dan North into evolving TDD into BDD, which is what we will discuss next.
  • This is a description of what BDD is and how it relates to TDD.
  • BDD also known as Acceptance Test Driven Development etc.
  • Transcript

    • 1. TDD & BDD Testing in F#Phil Trelford and Chis MarinosProgressive F# Tutorials 2011
    • 2. Organization REPL  REPL Task TDD  Introduction  Unit Testing Tasks BDD  Introduction  Acceptance Testing Tasks
    • 3. Unit Testing Frameworks F# supports all major unit testing frameworks  NUnit  xUnit  mbUnit  MsTest …
    • 4. Fluent Interfaces FsUnit FsTest NaturalSpec
    • 5. FsUnit[<Test>]let ``when player A wins the score should be 15-0`` () = [A] |> scoreGame |> should be (equal (Points(Fifteen,Zero)))
    • 6. Agile Manifesto Individuals and interactions over processes and tools Working software over comprehensive documentation Customer collaboration over contract negotiation Responding to change over following a plan
    • 7. Collaboration Developer Customers Business Testers Analyst
    • 8. User Stories
    • 9. Acceptance TestsRefunded items should be returned to stock Given a customer buys a black jumper And I have 3 black jumpers left in stock When he returns the black jumper for a refund Then I should have 4 black jumpers in stock
    • 10. Test Driven Development(TDD)Benefits Facilitates change  Refactoring  Regression Testing Documentation  API  Living Documentation Design  Classes, Methods  Behaviour
    • 11. Unit Testing“A good unit test needs both to illustrate and define the behavioural contract of the unit in question. Behaviour is more than just individual methods…” – Kevlin Henney
    • 12. Behaviour Driven Development(BDD)“Is an agile software development technique that encourages collaboration between Developers QA Business Participants in a software project.”“It extends TDD by writing test cases in a natural language that non-programmers can read.”
    • 13. Behaviour DrivenDevelopment (BDD)Benefits Facilitates Change  Refactoring  Regression  Rewriting Documentation  Behaviour  Living Documentation  Domain Language Defines Done  When all tests pass
    • 14. Team Workshops
    • 15. BA + Developer + QA
    • 16. Testers find holes
    • 17. BDD FrameworksExternal DSL Internal DSL Cuke4Nuke  MSpec NBehave  NaturalSpec StorEvil  NSpec SpecFlow  SpecsFor TickSpec  StoryQ
    • 18. DeclarationsGherkin NaturalSpecGiven I input 5 [<Scenario>] letWhen calculating the factorial ``When calculating factorial of 5 itThen the result is 120 should equal 120``() = Given 5 |> When calculating factorial |> It should equal 120 |> Verify
    • 19. First Steps in BDD on .Net • Shell StorEvil • C# & F# Gherkin NUnit • Visual Studio Visual SpecFlow Studio • C# ? • F# & C# ? • VS & Shell
    • 20. Look no hands
    • 21. Look no hands
    • 22. TickSpec
    • 23. Demo
    • 24. Task: BOGOF As a retailer I want to offer my customers buy one get one free promotions
    • 25. Step away from the tools“Start by having conversations, engaging bothtesters and business stakeholdersIf you can’t have those conversations, stop.You can’t do BDD” – Liz Keogh
    • 26. What makes a good feature file About the business domain In domain language Specification – not a script Easy to understand Focused on a single thing Precise and testable Self-explanatory Consistent Easy to access
    • 27. BDD Patterns: TablesScenario: Winning positions Given a board layout: | 1 | 2 | 3 | | O | O | X | | O | | | | X | | X | When I mark X at middle right Then I win
    • 28. What makes a bad feature file Long sentences Repetitious sentences Repetitive scenarios A never ending story Commentary And another thing
    • 29. BDD Patterns: ExamplesScenario: Winning positions Given a board layout: | 1 | 2 | 3 | | O | O | X | | O | | | | X | | X | When I mark X at <row> <col> Then I winExamples: | row | col | | middle | right | | middle | middle | | bottom | middle |
    • 30. Terrys Chocolate Oranges soldfor just 29p eachTwo simultaneouspromotions: three-for-£5 offer buy-one-get-one-freeEquals: £2.75 product Sells for 29p
    • 31. Yum!
    • 32. BDD Books
    • 33. Lifetime BDD Awards @tastapod @lunivore @gojkoadzic
    • 34. Q&A