SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Driving application
    development through
Behavior Driven Development
               by
       Einar Ingebrigtsen
Who am I?
  Consultant
  DoLittle Studios

  Silverlight MVP


 einar@dolittle.com
 twitter.com/einari
 http://www.ingebrigtsen.info
Who am I?

Author of Balder - 3D engine for Silverlight
http://balder.codeplex.com

Co-author of Bifrost - enterprise app framework
http://bifrost.dolittle.com

Co-author of Forseti - headless JS test runner
http://github.com/dolittlestudios/forseti
Win a Typemock Isolator /
   Isolator++ License
 During the webinar, tweet one cool
 takeaway or one tip that you learn with
 the hashtag #unittesting and @typemock.


 Typemock will then choose a winner and
 announce them next week.
Retro-style
   testing, 1996
9 phases of unit testing
•   What is unit testing?

•   Refuse to unit test because “you don’t have enough time”.

•   Fight it because it means writing more code

•   Start unit testing and start blogging / talking about unit testing and TDD and
    how great it is

•   Unit test everything - make private methods internal and abuse things like
    InternalVisibleTo attribute. 100% codecoverage is the only way to fly

•   Discover mocking and abuse it

•   Mock everything that is possible to be mocked
    (like the entire .net framework)

•   Start writing effective tests

•   Enjoy others trying to figure out why you hardly have any bugs at all
Why

• Improve quality
• Add predictability
• Add changeability
• Safety net
Test first
 “One of the most useful times to write tests is before
you start programming. When you need to add a feature,
                begin by writing the test.

 By writing the test you are asking yourself
          what needs to be done.”


                                                 Martin Fowler
Continuous

• Your tests are worthless without them being
  executed at a certain frequency

• Integrate your tests and production code often
  and have your tests along with others run
  frequently
The 10th phase
... or
skip all 9...
Lets talk about
  behaviors...
Background

• Coined by Dan North in 2006
 article in Better Software magazine

• Reaction to TDD
• Focus on behaviors of your system
Dialogue

• Improves the dialog with non-developers
• Mindset puts the developer closer to
 business value
• Easier for other developers to read
• Easier to get started with testing
Mindset

• Focus on business value; hence behavior
 in the system
• Your system doesn’t work with data - but
 behavior that might result in data
Where does it apply?

• In short; everywhere
• It fits perfectly for anything ranging from
  acceptance to unit level
• In fact; you might want to stribe towards
  using BDD consistently
Gherkin


• Business readable DSL
• Introduced by Aslak Hellesøy for
 Cucumber in 2008
Gherkin
Feature: Addition
  In order to avoid silly mistakes
  As a math idiot
  I want to be told the sum of two numbers

Scenario: Add two numbers
  Given I have entered 50 into the calculator
  And I have entered 70 into the calculator
  When I press add
  Then the result should be 120 on the screen
Gherkin
Feature: Addition
  In order to avoid silly mistakes
  As a math idiot
  I want to be told the sum of two numbers

Scenario: Add two numbers
  Given I have entered 50 into the calculator
  And I have entered 70 into the calculator
  When I press add
  Then the result should be 120 on the screen
Units

• Test behavior of the unit
• Tests interaction between systems
• Focus on decoupling
Test Doubles


• Provide implementations of dependent
 systems that are not real systems
• Good for decoupling
Fakes

• Working implementations
• Usually takes shortcuts unsuitable for
  production
 • In-memory database representations
Stubs


• Provide canned answers
• May record information about calls being
 made to it
Mocks
• Objects preprogrammed with expectations
• Often created adhoc by utilizing
 frameworks :
 • TypeMock
 • RhinoMocks
 • Moq
 • ... and more ...
Writing testable code

• Apply practices such as dependency
  inversion principle
 • Makes your code decoupled from real
   implementations
• In short - S.O.L.I.D. prinicples will get you
  there...
This changes everything
do e
        sn’t
This changes everything
Writing testable code

• Your code will change - but its a good
  thing, its not only for your tests!
• The principles that can be applied are
  good software development principles,
  regardless of testing or not
Frameworks?

• You can use your existing - remember; its
 a mindset, not a framework!
• NBehave
• MSpec
Structure

(project to specify).Specs
  (namespace)
      for_(unit to specify)
          given
              a_(context).cs
          when_(behavior to specify).cs
Structure
                               sample




 Bifrost.Specs
Commands
  for_CommandContext
    given
      a_command_context_for_a_simple_command_with_one_tracked_object.cs
    when_committing.cs
Frameworks

• SpecFlow
• StoryQ
• Cuke4Nuke
Feedback Loop
• Built-in test runner in Visual Studio is
  slow
• TestDriven.net - great alternative
• Auto-test running
 • Mighty Mooze - Continuous Test
   http://continuoustests.com/


 • NCrunch
   http://www.ncrunch.net/
Recommended
          reading
• Dan Norths blog
  http://dannorth.net/introducing-bdd/

• http://pragprog.com/book/hwcuc/the-cucumber-book
  The Cucumber book

• The RSpec book
  http://pragprog.com/book/achbd/the-rspec-book
.. one more thing ..
.. go and create software
     with less bugs.. :)

Weitere ähnliche Inhalte

Was ist angesagt?

How to be proud when you are done
How to be proud when you are doneHow to be proud when you are done
How to be proud when you are doneAleksey Solntsev
 
Creating change from within - Agile Practitioners 2012
Creating change from within - Agile Practitioners 2012Creating change from within - Agile Practitioners 2012
Creating change from within - Agile Practitioners 2012Dror Helper
 
Skills Matter DevSecOps eXchange Forum 2022 - Software architecture in a DevO...
Skills Matter DevSecOps eXchange Forum 2022 - Software architecture in a DevO...Skills Matter DevSecOps eXchange Forum 2022 - Software architecture in a DevO...
Skills Matter DevSecOps eXchange Forum 2022 - Software architecture in a DevO...Bert Jan Schrijver
 
Scala Days Chicago 2017: Building a Company on Scala
Scala Days Chicago 2017: Building a Company on ScalaScala Days Chicago 2017: Building a Company on Scala
Scala Days Chicago 2017: Building a Company on ScalaNatalie Vegel
 
I Don't Test Often ...
I Don't Test Often ...I Don't Test Often ...
I Don't Test Often ...Gareth Bowles
 
Continuous Integration, the minimum viable product
Continuous Integration, the minimum viable productContinuous Integration, the minimum viable product
Continuous Integration, the minimum viable productJulian Simpson
 
JavaLand 2022 - Debugging distributed systems
JavaLand 2022 - Debugging distributed systemsJavaLand 2022 - Debugging distributed systems
JavaLand 2022 - Debugging distributed systemsBert Jan Schrijver
 
130511 stop wasting_your_time
130511 stop wasting_your_time130511 stop wasting_your_time
130511 stop wasting_your_timeHenning Blohm
 
Bootstrapping Quality
Bootstrapping QualityBootstrapping Quality
Bootstrapping QualityMichael Roufa
 
It Sounded Good on Paper - Lessons Learned with Puppet
It Sounded Good on Paper - Lessons Learned with PuppetIt Sounded Good on Paper - Lessons Learned with Puppet
It Sounded Good on Paper - Lessons Learned with PuppetJeffery Smith
 
Continuous everything
Continuous everythingContinuous everything
Continuous everythingTEST Huddle
 
iOS Scroll Performance
iOS Scroll PerformanceiOS Scroll Performance
iOS Scroll PerformanceKyle Sherman
 
Software architecture in a DevOps world
Software architecture in a DevOps worldSoftware architecture in a DevOps world
Software architecture in a DevOps worldBert Jan Schrijver
 

Was ist angesagt? (20)

Code review
Code reviewCode review
Code review
 
Debugging distributed systems
Debugging distributed systemsDebugging distributed systems
Debugging distributed systems
 
XP Injection
XP InjectionXP Injection
XP Injection
 
How to be proud when you are done
How to be proud when you are doneHow to be proud when you are done
How to be proud when you are done
 
Creating change from within - Agile Practitioners 2012
Creating change from within - Agile Practitioners 2012Creating change from within - Agile Practitioners 2012
Creating change from within - Agile Practitioners 2012
 
Skills Matter DevSecOps eXchange Forum 2022 - Software architecture in a DevO...
Skills Matter DevSecOps eXchange Forum 2022 - Software architecture in a DevO...Skills Matter DevSecOps eXchange Forum 2022 - Software architecture in a DevO...
Skills Matter DevSecOps eXchange Forum 2022 - Software architecture in a DevO...
 
Scala Days Chicago 2017: Building a Company on Scala
Scala Days Chicago 2017: Building a Company on ScalaScala Days Chicago 2017: Building a Company on Scala
Scala Days Chicago 2017: Building a Company on Scala
 
I Don't Test Often ...
I Don't Test Often ...I Don't Test Often ...
I Don't Test Often ...
 
Continuous Integration, the minimum viable product
Continuous Integration, the minimum viable productContinuous Integration, the minimum viable product
Continuous Integration, the minimum viable product
 
JavaLand 2022 - Debugging distributed systems
JavaLand 2022 - Debugging distributed systemsJavaLand 2022 - Debugging distributed systems
JavaLand 2022 - Debugging distributed systems
 
130511 stop wasting_your_time
130511 stop wasting_your_time130511 stop wasting_your_time
130511 stop wasting_your_time
 
Bootstrapping Quality
Bootstrapping QualityBootstrapping Quality
Bootstrapping Quality
 
It Sounded Good on Paper - Lessons Learned with Puppet
It Sounded Good on Paper - Lessons Learned with PuppetIt Sounded Good on Paper - Lessons Learned with Puppet
It Sounded Good on Paper - Lessons Learned with Puppet
 
Continuous integration
Continuous integrationContinuous integration
Continuous integration
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Software testing
Software testingSoftware testing
Software testing
 
Unit testing for project managers
Unit testing for project managersUnit testing for project managers
Unit testing for project managers
 
Continuous everything
Continuous everythingContinuous everything
Continuous everything
 
iOS Scroll Performance
iOS Scroll PerformanceiOS Scroll Performance
iOS Scroll Performance
 
Software architecture in a DevOps world
Software architecture in a DevOps worldSoftware architecture in a DevOps world
Software architecture in a DevOps world
 

Ähnlich wie Driving application development through Behavior Driven Development

Understanding Why Testing is Importaint
Understanding Why Testing is ImportaintUnderstanding Why Testing is Importaint
Understanding Why Testing is ImportaintSana Nasar
 
A Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven DevelopmentA Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven DevelopmentShawn Jones
 
TDD - Seriously, try it! (updated '22)
TDD - Seriously, try it! (updated '22)TDD - Seriously, try it! (updated '22)
TDD - Seriously, try it! (updated '22)Nacho Cougil
 
Test Driven Development using QUnit
Test Driven Development using QUnitTest Driven Development using QUnit
Test Driven Development using QUnitsatejsahu
 
Extreme Programming (XP): Revisted
Extreme Programming (XP): RevistedExtreme Programming (XP): Revisted
Extreme Programming (XP): RevistedMike Harris
 
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)ssusercaf6c1
 
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)Nacho Cougil
 
Software Engineering in Startups
Software Engineering in StartupsSoftware Engineering in Startups
Software Engineering in StartupsDusan Omercevic
 
{10.0} Test Driven Development.pptx
{10.0} Test Driven Development.pptx{10.0} Test Driven Development.pptx
{10.0} Test Driven Development.pptxAmalEldhose2
 
Lean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill AyersLean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill AyersSPC Adriatics
 
TDD - Seriously, try it! - Bucarest Tech Week
TDD - Seriously, try it! - Bucarest Tech WeekTDD - Seriously, try it! - Bucarest Tech Week
TDD - Seriously, try it! - Bucarest Tech WeekNacho Cougil
 
Introduction to Automated Testing
Introduction to Automated TestingIntroduction to Automated Testing
Introduction to Automated TestingLars Thorup
 
Introduction to-automated-testing
Introduction to-automated-testingIntroduction to-automated-testing
Introduction to-automated-testingBestBrains
 
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019Jason Tice
 

Ähnlich wie Driving application development through Behavior Driven Development (20)

Understanding Why Testing is Importaint
Understanding Why Testing is ImportaintUnderstanding Why Testing is Importaint
Understanding Why Testing is Importaint
 
A Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven DevelopmentA Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven Development
 
It's XP, Stupid
It's XP, StupidIt's XP, Stupid
It's XP, Stupid
 
TDD - Seriously, try it! (updated '22)
TDD - Seriously, try it! (updated '22)TDD - Seriously, try it! (updated '22)
TDD - Seriously, try it! (updated '22)
 
Kku2011
Kku2011Kku2011
Kku2011
 
Test Driven Development using QUnit
Test Driven Development using QUnitTest Driven Development using QUnit
Test Driven Development using QUnit
 
Extreme Programming (XP): Revisted
Extreme Programming (XP): RevistedExtreme Programming (XP): Revisted
Extreme Programming (XP): Revisted
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
 
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
 
TDD in Agile
TDD in AgileTDD in Agile
TDD in Agile
 
Software Engineering in Startups
Software Engineering in StartupsSoftware Engineering in Startups
Software Engineering in Startups
 
{10.0} Test Driven Development.pptx
{10.0} Test Driven Development.pptx{10.0} Test Driven Development.pptx
{10.0} Test Driven Development.pptx
 
Agile
AgileAgile
Agile
 
QA and scrum
QA and scrumQA and scrum
QA and scrum
 
Lean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill AyersLean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill Ayers
 
TDD - Seriously, try it! - Bucarest Tech Week
TDD - Seriously, try it! - Bucarest Tech WeekTDD - Seriously, try it! - Bucarest Tech Week
TDD - Seriously, try it! - Bucarest Tech Week
 
Introduction to Automated Testing
Introduction to Automated TestingIntroduction to Automated Testing
Introduction to Automated Testing
 
Introduction to-automated-testing
Introduction to-automated-testingIntroduction to-automated-testing
Introduction to-automated-testing
 
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
 

Mehr von Einar Ingebrigtsen

Making your application realtime with signal r
Making your application realtime with signal rMaking your application realtime with signal r
Making your application realtime with signal rEinar Ingebrigtsen
 
It's Primetime: A Javascript Story
It's Primetime: A Javascript StoryIt's Primetime: A Javascript Story
It's Primetime: A Javascript StoryEinar Ingebrigtsen
 
Windows Azure Camps - Oktober 2012
Windows Azure Camps - Oktober 2012Windows Azure Camps - Oktober 2012
Windows Azure Camps - Oktober 2012Einar Ingebrigtsen
 
Closing the gap between Web and Desktop with WinRT
Closing the gap between Web and Desktop with WinRTClosing the gap between Web and Desktop with WinRT
Closing the gap between Web and Desktop with WinRTEinar Ingebrigtsen
 
Sugarcoating your frontend one ViewModel at a time
Sugarcoating your frontend one ViewModel at a timeSugarcoating your frontend one ViewModel at a time
Sugarcoating your frontend one ViewModel at a timeEinar Ingebrigtsen
 

Mehr von Einar Ingebrigtsen (10)

Making your application realtime with signal r
Making your application realtime with signal rMaking your application realtime with signal r
Making your application realtime with signal r
 
It's Primetime: A Javascript Story
It's Primetime: A Javascript StoryIt's Primetime: A Javascript Story
It's Primetime: A Javascript Story
 
Lets focus on business value
Lets focus on business valueLets focus on business value
Lets focus on business value
 
Lets focus on business value
Lets focus on business valueLets focus on business value
Lets focus on business value
 
Lets focus on business value
Lets focus on business valueLets focus on business value
Lets focus on business value
 
Windows Azure Camps - Oktober 2012
Windows Azure Camps - Oktober 2012Windows Azure Camps - Oktober 2012
Windows Azure Camps - Oktober 2012
 
Developing on Windows 8
Developing on Windows 8Developing on Windows 8
Developing on Windows 8
 
Windows 8 BootCamp
Windows 8 BootCampWindows 8 BootCamp
Windows 8 BootCamp
 
Closing the gap between Web and Desktop with WinRT
Closing the gap between Web and Desktop with WinRTClosing the gap between Web and Desktop with WinRT
Closing the gap between Web and Desktop with WinRT
 
Sugarcoating your frontend one ViewModel at a time
Sugarcoating your frontend one ViewModel at a timeSugarcoating your frontend one ViewModel at a time
Sugarcoating your frontend one ViewModel at a time
 

Kürzlich hochgeladen

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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
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
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 

Kürzlich hochgeladen (20)

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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Driving application development through Behavior Driven Development

  • 1.
  • 2. Driving application development through Behavior Driven Development by Einar Ingebrigtsen
  • 3. Who am I? Consultant DoLittle Studios Silverlight MVP einar@dolittle.com twitter.com/einari http://www.ingebrigtsen.info
  • 4. Who am I? Author of Balder - 3D engine for Silverlight http://balder.codeplex.com Co-author of Bifrost - enterprise app framework http://bifrost.dolittle.com Co-author of Forseti - headless JS test runner http://github.com/dolittlestudios/forseti
  • 5. Win a Typemock Isolator / Isolator++ License During the webinar, tweet one cool takeaway or one tip that you learn with the hashtag #unittesting and @typemock. Typemock will then choose a winner and announce them next week.
  • 6. Retro-style testing, 1996
  • 7. 9 phases of unit testing • What is unit testing? • Refuse to unit test because “you don’t have enough time”. • Fight it because it means writing more code • Start unit testing and start blogging / talking about unit testing and TDD and how great it is • Unit test everything - make private methods internal and abuse things like InternalVisibleTo attribute. 100% codecoverage is the only way to fly • Discover mocking and abuse it • Mock everything that is possible to be mocked (like the entire .net framework) • Start writing effective tests • Enjoy others trying to figure out why you hardly have any bugs at all
  • 8. Why • Improve quality • Add predictability • Add changeability • Safety net
  • 9. Test first “One of the most useful times to write tests is before you start programming. When you need to add a feature, begin by writing the test. By writing the test you are asking yourself what needs to be done.” Martin Fowler
  • 10. Continuous • Your tests are worthless without them being executed at a certain frequency • Integrate your tests and production code often and have your tests along with others run frequently
  • 13. Lets talk about behaviors...
  • 14. Background • Coined by Dan North in 2006 article in Better Software magazine • Reaction to TDD • Focus on behaviors of your system
  • 15. Dialogue • Improves the dialog with non-developers • Mindset puts the developer closer to business value • Easier for other developers to read • Easier to get started with testing
  • 16. Mindset • Focus on business value; hence behavior in the system • Your system doesn’t work with data - but behavior that might result in data
  • 17. Where does it apply? • In short; everywhere • It fits perfectly for anything ranging from acceptance to unit level • In fact; you might want to stribe towards using BDD consistently
  • 18. Gherkin • Business readable DSL • Introduced by Aslak Hellesøy for Cucumber in 2008
  • 19. Gherkin Feature: Addition In order to avoid silly mistakes As a math idiot I want to be told the sum of two numbers Scenario: Add two numbers Given I have entered 50 into the calculator And I have entered 70 into the calculator When I press add Then the result should be 120 on the screen
  • 20. Gherkin Feature: Addition In order to avoid silly mistakes As a math idiot I want to be told the sum of two numbers Scenario: Add two numbers Given I have entered 50 into the calculator And I have entered 70 into the calculator When I press add Then the result should be 120 on the screen
  • 21. Units • Test behavior of the unit • Tests interaction between systems • Focus on decoupling
  • 22. Test Doubles • Provide implementations of dependent systems that are not real systems • Good for decoupling
  • 23. Fakes • Working implementations • Usually takes shortcuts unsuitable for production • In-memory database representations
  • 24. Stubs • Provide canned answers • May record information about calls being made to it
  • 25. Mocks • Objects preprogrammed with expectations • Often created adhoc by utilizing frameworks : • TypeMock • RhinoMocks • Moq • ... and more ...
  • 26. Writing testable code • Apply practices such as dependency inversion principle • Makes your code decoupled from real implementations • In short - S.O.L.I.D. prinicples will get you there...
  • 28. do e sn’t This changes everything
  • 29. Writing testable code • Your code will change - but its a good thing, its not only for your tests! • The principles that can be applied are good software development principles, regardless of testing or not
  • 30. Frameworks? • You can use your existing - remember; its a mindset, not a framework! • NBehave • MSpec
  • 31. Structure (project to specify).Specs (namespace) for_(unit to specify) given a_(context).cs when_(behavior to specify).cs
  • 32. Structure sample Bifrost.Specs Commands for_CommandContext given a_command_context_for_a_simple_command_with_one_tracked_object.cs when_committing.cs
  • 34.
  • 35. Feedback Loop • Built-in test runner in Visual Studio is slow • TestDriven.net - great alternative • Auto-test running • Mighty Mooze - Continuous Test http://continuoustests.com/ • NCrunch http://www.ncrunch.net/
  • 36. Recommended reading • Dan Norths blog http://dannorth.net/introducing-bdd/ • http://pragprog.com/book/hwcuc/the-cucumber-book The Cucumber book • The RSpec book http://pragprog.com/book/achbd/the-rspec-book
  • 37.
  • 38. .. one more thing ..
  • 39. .. go and create software with less bugs.. :)

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n