SlideShare ist ein Scribd-Unternehmen logo
1 von 34
TDD & BDD
   Testing in F#
Phil Trelford and Chis Marinos
Progressive F# Tutorials 2011
Organization

   REPL
       REPL Task
   TDD
     Introduction
     Unit Testing Tasks

   BDD
     Introduction
     Acceptance Testing Tasks
Unit Testing Frameworks


   F# supports all major unit testing frameworks
     NUnit
     xUnit
     mbUnit
     MsTest
    …
Fluent Interfaces


 FsUnit
 FsTest
 NaturalSpec
FsUnit

[<Test>]
let ``when player A wins the score should be 15-0`` () =
    [A]
    |> scoreGame
    |> should be (equal (Points(Fifteen,Zero)))
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
Collaboration


     Developer   Customers




                 Business
      Testers
                  Analyst
User Stories
Acceptance Tests


Refunded 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
Test Driven Development
(TDD)
Benefits
 Facilitates change
       Refactoring
       Regression Testing
   Documentation
       API
       Living Documentation
   Design
       Classes, Methods
       Behaviour
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
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.”
Behaviour Driven
Development (BDD)
Benefits
 Facilitates Change
       Refactoring
       Regression
       Rewriting
   Documentation
       Behaviour
       Living Documentation
       Domain Language
   Defines Done
       When all tests pass
Team Workshops
BA + Developer + QA
Testers find holes
BDD Frameworks
External DSL    Internal DSL

   Cuke4Nuke      MSpec
   NBehave        NaturalSpec
   StorEvil       NSpec
   SpecFlow       SpecsFor
   TickSpec       StoryQ
Declarations
Gherkin                          NaturalSpec
Given I input 5                  [<Scenario>] let
When calculating the factorial   ``When calculating factorial of 5 it
Then the result is 120           should equal 120``() =
                                 Given 5
                                 |> When calculating factorial
                                 |> It should equal 120
                                 |> Verify
First Steps in BDD on .Net

            • Shell
 StorEvil
            • C# & F#
                                        Gherkin
                              NUnit


            • Visual Studio           Visual
 SpecFlow                             Studio
            • C#


                                      ?
            • F# & C#
    ?
            • VS & Shell
Look no hands
Look no hands
TickSpec
Demo
Task: BOGOF

   As a retailer I want to offer my customers buy
    one get one free promotions
Step away from the tools


“Start by having conversations, engaging both
testers and business stakeholders
If you can’t have those conversations, stop.
You can’t do BDD” – Liz Keogh
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
BDD Patterns: Tables
Scenario: 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
What makes a bad feature file

 Long sentences
 Repetitious sentences
 Repetitive scenarios


 A never ending story
 Commentary
 And another thing
BDD Patterns: Examples
Scenario: Winning positions
       Given a board layout:
              | 1 | 2 | 3 |
              | O | O | X |
              | O |   |   |
              | X |   | X |
       When I mark X at <row> <col>
       Then I win

Examples:
       | row      |   col      |
       | middle   |   right    |
       | middle   |   middle   |
       | bottom   |   middle   |
Terry's Chocolate Oranges sold
for just 29p each
Two simultaneous
promotions:
 three-for-£5 offer
 buy-one-get-one-free


Equals:
 £2.75 product
 Sells for 29p
Yum!
BDD Books
Lifetime BDD Awards


           @tastapod

            @lunivore

           @gojkoadzic
Q&A

Weitere ähnliche Inhalte

Ähnlich wie TDD & BDD in F# at Progressive F# Tutorials 2011

NDC 2011 - SpecFlow: Pragmatic BDD for .NET
NDC 2011 - SpecFlow: Pragmatic BDD for .NETNDC 2011 - SpecFlow: Pragmatic BDD for .NET
NDC 2011 - SpecFlow: Pragmatic BDD for .NETjbandi
 
Java Zone 2017 - Build the right system
Java Zone 2017  - Build the right systemJava Zone 2017  - Build the right system
Java Zone 2017 - Build the right systemCecilie Haugstvedt
 
Spec(ing) Out Your Workflow with SpecFlow
Spec(ing) Out Your Workflow with SpecFlowSpec(ing) Out Your Workflow with SpecFlow
Spec(ing) Out Your Workflow with SpecFlowSarah Dutkiewicz
 
Agile Software Development in Practice - A Developer Perspective
Agile Software Development in Practice - A Developer PerspectiveAgile Software Development in Practice - A Developer Perspective
Agile Software Development in Practice - A Developer PerspectiveWee Witthawaskul
 
Behavior Driven Development: An Overview
Behavior Driven Development:  An OverviewBehavior Driven Development:  An Overview
Behavior Driven Development: An Overviewbmaynard_at_litle
 
Introduction to Bdd and cucumber
Introduction to Bdd and cucumberIntroduction to Bdd and cucumber
Introduction to Bdd and cucumberNibu Baby
 
Bdd - L'arte di non farsi i fatti propri
Bdd - L'arte di non farsi i fatti propriBdd - L'arte di non farsi i fatti propri
Bdd - L'arte di non farsi i fatti propriCommit University
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven DevelopmentMarakana Inc.
 
Behaviour Driven Development and Thinking About Testing
Behaviour Driven Development and Thinking About TestingBehaviour Driven Development and Thinking About Testing
Behaviour Driven Development and Thinking About Testingdn
 
Bdd and-testing
Bdd and-testingBdd and-testing
Bdd and-testingmalcolmt
 
Pair programming and introduction to TDD
Pair programming and introduction to TDDPair programming and introduction to TDD
Pair programming and introduction to TDDArati Joshi
 
BA and Beyond 20 - Elke Steegmans and David Vandenbroeck - Behaviour-driven d...
BA and Beyond 20 - Elke Steegmans and David Vandenbroeck - Behaviour-driven d...BA and Beyond 20 - Elke Steegmans and David Vandenbroeck - Behaviour-driven d...
BA and Beyond 20 - Elke Steegmans and David Vandenbroeck - Behaviour-driven d...BA and Beyond
 
Emily Bache - Readable, Executable Requirements: Hands-On - EuroSTAR 2013
Emily Bache - Readable, Executable Requirements: Hands-On - EuroSTAR 2013Emily Bache - Readable, Executable Requirements: Hands-On - EuroSTAR 2013
Emily Bache - Readable, Executable Requirements: Hands-On - EuroSTAR 2013TEST Huddle
 
BDD testing with cucumber
BDD testing with cucumberBDD testing with cucumber
BDD testing with cucumberDaniel Kummer
 
Prashant technical practices-tdd for xebia event
Prashant   technical practices-tdd for xebia eventPrashant   technical practices-tdd for xebia event
Prashant technical practices-tdd for xebia eventXebia India
 
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Building In Quality: The Beauty Of Behavior Driven Development (BDD)Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Building In Quality: The Beauty Of Behavior Driven Development (BDD)Synerzip
 
Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy Vijay Kumbhar
 

Ähnlich wie TDD & BDD in F# at Progressive F# Tutorials 2011 (20)

BDD with F# at DDDBelfast
BDD with F# at DDDBelfastBDD with F# at DDDBelfast
BDD with F# at DDDBelfast
 
NDC 2011 - SpecFlow: Pragmatic BDD for .NET
NDC 2011 - SpecFlow: Pragmatic BDD for .NETNDC 2011 - SpecFlow: Pragmatic BDD for .NET
NDC 2011 - SpecFlow: Pragmatic BDD for .NET
 
Java Zone 2017 - Build the right system
Java Zone 2017  - Build the right systemJava Zone 2017  - Build the right system
Java Zone 2017 - Build the right system
 
Spec(ing) Out Your Workflow with SpecFlow
Spec(ing) Out Your Workflow with SpecFlowSpec(ing) Out Your Workflow with SpecFlow
Spec(ing) Out Your Workflow with SpecFlow
 
Agile Software Development in Practice - A Developer Perspective
Agile Software Development in Practice - A Developer PerspectiveAgile Software Development in Practice - A Developer Perspective
Agile Software Development in Practice - A Developer Perspective
 
Behavior Driven Development: An Overview
Behavior Driven Development:  An OverviewBehavior Driven Development:  An Overview
Behavior Driven Development: An Overview
 
Introduction to Bdd and cucumber
Introduction to Bdd and cucumberIntroduction to Bdd and cucumber
Introduction to Bdd and cucumber
 
Bdd - L'arte di non farsi i fatti propri
Bdd - L'arte di non farsi i fatti propriBdd - L'arte di non farsi i fatti propri
Bdd - L'arte di non farsi i fatti propri
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven Development
 
Behaviour Driven Development and Thinking About Testing
Behaviour Driven Development and Thinking About TestingBehaviour Driven Development and Thinking About Testing
Behaviour Driven Development and Thinking About Testing
 
Bdd and-testing
Bdd and-testingBdd and-testing
Bdd and-testing
 
TDD refresher
TDD refresherTDD refresher
TDD refresher
 
Pair programming and introduction to TDD
Pair programming and introduction to TDDPair programming and introduction to TDD
Pair programming and introduction to TDD
 
BA and Beyond 20 - Elke Steegmans and David Vandenbroeck - Behaviour-driven d...
BA and Beyond 20 - Elke Steegmans and David Vandenbroeck - Behaviour-driven d...BA and Beyond 20 - Elke Steegmans and David Vandenbroeck - Behaviour-driven d...
BA and Beyond 20 - Elke Steegmans and David Vandenbroeck - Behaviour-driven d...
 
Emily Bache - Readable, Executable Requirements: Hands-On - EuroSTAR 2013
Emily Bache - Readable, Executable Requirements: Hands-On - EuroSTAR 2013Emily Bache - Readable, Executable Requirements: Hands-On - EuroSTAR 2013
Emily Bache - Readable, Executable Requirements: Hands-On - EuroSTAR 2013
 
BDD testing with cucumber
BDD testing with cucumberBDD testing with cucumber
BDD testing with cucumber
 
Tdd in practice
Tdd in practiceTdd in practice
Tdd in practice
 
Prashant technical practices-tdd for xebia event
Prashant   technical practices-tdd for xebia eventPrashant   technical practices-tdd for xebia event
Prashant technical practices-tdd for xebia event
 
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Building In Quality: The Beauty Of Behavior Driven Development (BDD)Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
 
Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy
 

Mehr von Phillip Trelford

How to be a rock star developer
How to be a rock star developerHow to be a rock star developer
How to be a rock star developerPhillip Trelford
 
FSharp eye for the Haskell guy - London 2015
FSharp eye for the Haskell guy - London 2015FSharp eye for the Haskell guy - London 2015
FSharp eye for the Haskell guy - London 2015Phillip Trelford
 
Beyond lists - Copenhagen 2015
Beyond lists - Copenhagen 2015Beyond lists - Copenhagen 2015
Beyond lists - Copenhagen 2015Phillip Trelford
 
F# for C# devs - Copenhagen .Net 2015
F# for C# devs - Copenhagen .Net 2015F# for C# devs - Copenhagen .Net 2015
F# for C# devs - Copenhagen .Net 2015Phillip Trelford
 
Generative Art - Functional Vilnius 2015
Generative Art - Functional Vilnius 2015Generative Art - Functional Vilnius 2015
Generative Art - Functional Vilnius 2015Phillip Trelford
 
24 hours later - FSharp Gotham 2015
24 hours later - FSharp Gotham  201524 hours later - FSharp Gotham  2015
24 hours later - FSharp Gotham 2015Phillip Trelford
 
Building cross platform games with Xamarin - Birmingham 2015
Building cross platform games with Xamarin - Birmingham 2015Building cross platform games with Xamarin - Birmingham 2015
Building cross platform games with Xamarin - Birmingham 2015Phillip Trelford
 
Beyond Lists - Functional Kats Conf Dublin 2015
Beyond Lists - Functional Kats Conf Dublin 2015Beyond Lists - Functional Kats Conf Dublin 2015
Beyond Lists - Functional Kats Conf Dublin 2015Phillip Trelford
 
FSharp On The Desktop - Birmingham FP 2015
FSharp On The Desktop - Birmingham FP 2015FSharp On The Desktop - Birmingham FP 2015
FSharp On The Desktop - Birmingham FP 2015Phillip Trelford
 
Ready, steady, cross platform games - ProgNet 2015
Ready, steady, cross platform games - ProgNet 2015Ready, steady, cross platform games - ProgNet 2015
Ready, steady, cross platform games - ProgNet 2015Phillip Trelford
 
F# for C# devs - NDC Oslo 2015
F# for C# devs - NDC Oslo 2015F# for C# devs - NDC Oslo 2015
F# for C# devs - NDC Oslo 2015Phillip Trelford
 
F# for C# devs - Leeds Sharp 2015
F# for C# devs -  Leeds Sharp 2015F# for C# devs -  Leeds Sharp 2015
F# for C# devs - Leeds Sharp 2015Phillip Trelford
 
Build a compiler in 2hrs - NCrafts Paris 2015
Build a compiler in 2hrs -  NCrafts Paris 2015Build a compiler in 2hrs -  NCrafts Paris 2015
Build a compiler in 2hrs - NCrafts Paris 2015Phillip Trelford
 
24 Hours Later - NCrafts Paris 2015
24 Hours Later - NCrafts Paris 201524 Hours Later - NCrafts Paris 2015
24 Hours Later - NCrafts Paris 2015Phillip Trelford
 
Machine learning from disaster - GL.Net 2015
Machine learning from disaster  - GL.Net 2015Machine learning from disaster  - GL.Net 2015
Machine learning from disaster - GL.Net 2015Phillip Trelford
 
F# for Trading - QuantLabs 2014
F# for Trading -  QuantLabs 2014F# for Trading -  QuantLabs 2014
F# for Trading - QuantLabs 2014Phillip Trelford
 

Mehr von Phillip Trelford (20)

How to be a rock star developer
How to be a rock star developerHow to be a rock star developer
How to be a rock star developer
 
Mobile F#un
Mobile F#unMobile F#un
Mobile F#un
 
F# eXchange Keynote 2016
F# eXchange Keynote 2016F# eXchange Keynote 2016
F# eXchange Keynote 2016
 
FSharp eye for the Haskell guy - London 2015
FSharp eye for the Haskell guy - London 2015FSharp eye for the Haskell guy - London 2015
FSharp eye for the Haskell guy - London 2015
 
Beyond lists - Copenhagen 2015
Beyond lists - Copenhagen 2015Beyond lists - Copenhagen 2015
Beyond lists - Copenhagen 2015
 
F# for C# devs - Copenhagen .Net 2015
F# for C# devs - Copenhagen .Net 2015F# for C# devs - Copenhagen .Net 2015
F# for C# devs - Copenhagen .Net 2015
 
Generative Art - Functional Vilnius 2015
Generative Art - Functional Vilnius 2015Generative Art - Functional Vilnius 2015
Generative Art - Functional Vilnius 2015
 
24 hours later - FSharp Gotham 2015
24 hours later - FSharp Gotham  201524 hours later - FSharp Gotham  2015
24 hours later - FSharp Gotham 2015
 
Building cross platform games with Xamarin - Birmingham 2015
Building cross platform games with Xamarin - Birmingham 2015Building cross platform games with Xamarin - Birmingham 2015
Building cross platform games with Xamarin - Birmingham 2015
 
Beyond Lists - Functional Kats Conf Dublin 2015
Beyond Lists - Functional Kats Conf Dublin 2015Beyond Lists - Functional Kats Conf Dublin 2015
Beyond Lists - Functional Kats Conf Dublin 2015
 
FSharp On The Desktop - Birmingham FP 2015
FSharp On The Desktop - Birmingham FP 2015FSharp On The Desktop - Birmingham FP 2015
FSharp On The Desktop - Birmingham FP 2015
 
Ready, steady, cross platform games - ProgNet 2015
Ready, steady, cross platform games - ProgNet 2015Ready, steady, cross platform games - ProgNet 2015
Ready, steady, cross platform games - ProgNet 2015
 
F# for C# devs - NDC Oslo 2015
F# for C# devs - NDC Oslo 2015F# for C# devs - NDC Oslo 2015
F# for C# devs - NDC Oslo 2015
 
F# for C# devs - Leeds Sharp 2015
F# for C# devs -  Leeds Sharp 2015F# for C# devs -  Leeds Sharp 2015
F# for C# devs - Leeds Sharp 2015
 
Build a compiler in 2hrs - NCrafts Paris 2015
Build a compiler in 2hrs -  NCrafts Paris 2015Build a compiler in 2hrs -  NCrafts Paris 2015
Build a compiler in 2hrs - NCrafts Paris 2015
 
24 Hours Later - NCrafts Paris 2015
24 Hours Later - NCrafts Paris 201524 Hours Later - NCrafts Paris 2015
24 Hours Later - NCrafts Paris 2015
 
Real World F# - SDD 2015
Real World F# -  SDD 2015Real World F# -  SDD 2015
Real World F# - SDD 2015
 
F# for C# devs - SDD 2015
F# for C# devs - SDD 2015F# for C# devs - SDD 2015
F# for C# devs - SDD 2015
 
Machine learning from disaster - GL.Net 2015
Machine learning from disaster  - GL.Net 2015Machine learning from disaster  - GL.Net 2015
Machine learning from disaster - GL.Net 2015
 
F# for Trading - QuantLabs 2014
F# for Trading -  QuantLabs 2014F# for Trading -  QuantLabs 2014
F# for Trading - QuantLabs 2014
 

Kürzlich hochgeladen

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Kürzlich hochgeladen (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

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

  • 1. TDD & BDD Testing in F# Phil Trelford and Chis Marinos Progressive 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
  • 9. Acceptance Tests Refunded 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 Driven Development (BDD) Benefits  Facilitates Change  Refactoring  Regression  Rewriting  Documentation  Behaviour  Living Documentation  Domain Language  Defines Done  When all tests pass
  • 17. BDD Frameworks External DSL Internal DSL  Cuke4Nuke  MSpec  NBehave  NaturalSpec  StorEvil  NSpec  SpecFlow  SpecsFor  TickSpec  StoryQ
  • 18. Declarations Gherkin NaturalSpec Given I input 5 [<Scenario>] let When calculating the factorial ``When calculating factorial of 5 it Then 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
  • 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 both testers and business stakeholders If 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: Tables Scenario: 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: Examples Scenario: Winning positions Given a board layout: | 1 | 2 | 3 | | O | O | X | | O | | | | X | | X | When I mark X at <row> <col> Then I win Examples: | row | col | | middle | right | | middle | middle | | bottom | middle |
  • 30. Terry's Chocolate Oranges sold for just 29p each Two simultaneous promotions:  three-for-£5 offer  buy-one-get-one-free Equals:  £2.75 product  Sells for 29p
  • 31. Yum!
  • 33. Lifetime BDD Awards @tastapod @lunivore @gojkoadzic
  • 34. Q&A

Hinweis der Redaktion

  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 contract”These 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.