SlideShare a Scribd company logo
1 of 20
What is TDD?
(answer: Test-Driven Development)


    … and why you should care

Clear Lines Consulting · clear-lines.com   11/8/2011 · 1
Once upon a Time…

    Design

                                   Implement

                                               Test




Clear Lines Consulting · clear-lines.com              11/8/2011 · 2
Stay buggy, my friends!




Clear Lines Consulting · clear-lines.com   11/8/2011 · 3
Start with the tests!




                                           If I needed to Add 1 + 1…
Clear Lines Consulting · clear-lines.com                       11/8/2011 · 4
If I needed to Add 1 + 1…
[Test]
public void When_Adding_One_Plus_One_Answer_Should_Be_Two()
{
  // Assert
  var expectedResult = 2;
  Assert.That(actualResult, Is.EqualTo(expectedResult));
}




                         … I would expect the answer to be 2
Clear Lines Consulting · clear-lines.com              11/8/2011 · 5
If I needed to Add 1 + 1…
[Test]
public void When_Adding_One_Plus_One_Answer_Should_Be_Two()
{
  // Act
  var actualResult = calculator.Add(1, 1);

    // Assert
    var expectedResult = 2;
    Assert.That(actualResult, Is.EqualTo(expectedResult));
}



                                           … I would need a Calculator
Clear Lines Consulting · clear-lines.com                        11/8/2011 · 6
If I needed to Add 1 + 1…
[Test]
public void When_Adding_One_Plus_One_Answer_Should_Be_Two()
{
  // Arrange
  var calculator = new Calculator();

    // Act
    var actualResult = calculator.Add(1, 1);

    // Assert
    var expectedResult = 2;
    Assert.That(actualResult, Is.EqualTo(expectedResult));
}

                                           … I would need some code
Clear Lines Consulting · clear-lines.com                     11/8/2011 · 7
If I needed to Add 1 + 1…




                                           … Does the code work?
Clear Lines Consulting · clear-lines.com                  11/8/2011 · 8
Testing frameworks




       MsTest

Clear Lines Consulting · clear-lines.com   11/8/2011 · 9
It’s not about Testing

»    It’s about writing Code that works, now
»    Imagine you had implemented the feature
»    … then implement it
»    Rinse & Repeat until you have no test to write




Clear Lines Consulting · clear-lines.com      11/8/2011 · 10
Why should you care?



Clear Lines Consulting · clear-lines.com   11/8/2011 · 11
The dreaded L word




                                           © www.dilbert.com
Clear Lines Consulting · clear-lines.com              11/8/2011 · 12
“To me, legacy code is
 simply code without
 tests.”
         Michael Feathers,
                   Working Effectively with Legacy Code

Clear Lines Consulting · clear-lines.com          11/8/2011 · 13
Did I break everything?




Clear Lines Consulting · clear-lines.com   11/8/2011 · 14
Tests: a Vise holding your code steady




Clear Lines Consulting · clear-lines.com   11/8/2011 · 15
A good test is

» Fast
» Focused
» Replicable
» Automated



Clear Lines Consulting · clear-lines.com   11/8/2011 · 16
Refactoring: improve the
       code structure, without
       changing its external
       behavior.

Clear Lines Consulting · clear-lines.com   11/8/2011 · 17
Red, Green, Refactor

                                   » Red: write a little test
                                     that doesn’t work
                                   » Green: make the test
                                     work quickly
                                   » Refactor: cleanup time!

Clear Lines Consulting · clear-lines.com                 11/8/2011 · 18
Test-Driven Development is a
    way of managing fear during
    programming.
                         Kent Beck,
                                           Test-Driven Development by Example




Clear Lines Consulting · clear-lines.com                                11/8/2011 · 19
The Cast
» Me: Mathias Brandewinder
       – mathias@clear-lines.com (clear-lines.com/blog)
» Frameworks/Tools
       – NUnit: www.nunit.org
       – xUnit: xunit.codeplex.com/
       – Resharper: www.jetbrains.com/resharper/
» Books
       – Kent Beck, “Test Driven Development by Example”
       – Michael Feathers, “Working Effectively with Legacy
         Code”
       – Roy Osherove, “The Art of Unit Testing”
Clear Lines Consulting · clear-lines.com               11/8/2011 · 20

More Related Content

Similar to BizSpark SF Lightning Talk: "Refactoring and Test-Driven Development" by Mathias Brandewinder

Agile methods series (xp)
Agile methods series (xp)Agile methods series (xp)
Agile methods series (xp)XPDays
 
Extreme delivery - Lean Agile Scotland 2019 (Abridged)
Extreme delivery - Lean Agile Scotland 2019 (Abridged)Extreme delivery - Lean Agile Scotland 2019 (Abridged)
Extreme delivery - Lean Agile Scotland 2019 (Abridged)Eddie Kenny
 
Pinpointing and Exploiting Specific Performance Bottlenecks
Pinpointing and Exploiting Specific Performance BottlenecksPinpointing and Exploiting Specific Performance Bottlenecks
Pinpointing and Exploiting Specific Performance BottlenecksScott Barber
 
Test Driven Development Powered by LEGO
Test Driven Development Powered by LEGOTest Driven Development Powered by LEGO
Test Driven Development Powered by LEGOAgile Montréal
 
Testing and DevOps Culture: Lessons Learned
Testing and DevOps Culture: Lessons LearnedTesting and DevOps Culture: Lessons Learned
Testing and DevOps Culture: Lessons LearnedLB Denker
 
Thuy_Tran_Ngoc_-_SD0585
Thuy_Tran_Ngoc_-_SD0585Thuy_Tran_Ngoc_-_SD0585
Thuy_Tran_Ngoc_-_SD0585tester Tran
 
E xtreme programming for etl and data analytics final
E xtreme programming for etl and data analytics finalE xtreme programming for etl and data analytics final
E xtreme programming for etl and data analytics finalPrafulla Girgaonkar
 
How to test a Mainframe Application
How to test a Mainframe ApplicationHow to test a Mainframe Application
How to test a Mainframe ApplicationMichael Erichsen
 
Introducing Agile Methodologies
Introducing Agile MethodologiesIntroducing Agile Methodologies
Introducing Agile MethodologiesStfalcon Meetups
 
SbE - Requirements in an agile process
SbE - Requirements in an agile processSbE - Requirements in an agile process
SbE - Requirements in an agile processChris Schotanus
 
Introduction to Agile Software Development Process
Introduction to Agile Software Development ProcessIntroduction to Agile Software Development Process
Introduction to Agile Software Development ProcessSoftware Park Thailand
 
Bilbostack19 devops is not what you think
Bilbostack19 devops is not what you thinkBilbostack19 devops is not what you think
Bilbostack19 devops is not what you thinkEduardo Ferro Aldama
 
devops, microservices, and platforms, oh my!
devops, microservices, and platforms, oh my!devops, microservices, and platforms, oh my!
devops, microservices, and platforms, oh my!Andrew Shafer
 
Cloud Foundry Summit 2015: Devops, microservices and platforms, oh my!
Cloud Foundry Summit 2015: Devops, microservices and platforms, oh my!Cloud Foundry Summit 2015: Devops, microservices and platforms, oh my!
Cloud Foundry Summit 2015: Devops, microservices and platforms, oh my!VMware Tanzu
 
Lessons Learned from Large Scale Adoption of DevOps for IBM z Systems Software
Lessons Learned from Large Scale Adoption of DevOps for IBM z Systems SoftwareLessons Learned from Large Scale Adoption of DevOps for IBM z Systems Software
Lessons Learned from Large Scale Adoption of DevOps for IBM z Systems SoftwareDevOps for Enterprise Systems
 
apidays LIVE New York - Navigating the Sea of Javascript Tools to Discover Sc...
apidays LIVE New York - Navigating the Sea of Javascript Tools to Discover Sc...apidays LIVE New York - Navigating the Sea of Javascript Tools to Discover Sc...
apidays LIVE New York - Navigating the Sea of Javascript Tools to Discover Sc...apidays
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flexmichael.labriola
 

Similar to BizSpark SF Lightning Talk: "Refactoring and Test-Driven Development" by Mathias Brandewinder (20)

Agile methods series (xp)
Agile methods series (xp)Agile methods series (xp)
Agile methods series (xp)
 
Extreme delivery - Lean Agile Scotland 2019 (Abridged)
Extreme delivery - Lean Agile Scotland 2019 (Abridged)Extreme delivery - Lean Agile Scotland 2019 (Abridged)
Extreme delivery - Lean Agile Scotland 2019 (Abridged)
 
Pinpointing and Exploiting Specific Performance Bottlenecks
Pinpointing and Exploiting Specific Performance BottlenecksPinpointing and Exploiting Specific Performance Bottlenecks
Pinpointing and Exploiting Specific Performance Bottlenecks
 
Test Driven Development Powered by LEGO
Test Driven Development Powered by LEGOTest Driven Development Powered by LEGO
Test Driven Development Powered by LEGO
 
Testing and DevOps Culture: Lessons Learned
Testing and DevOps Culture: Lessons LearnedTesting and DevOps Culture: Lessons Learned
Testing and DevOps Culture: Lessons Learned
 
Thuy_Tran_Ngoc_-_SD0585
Thuy_Tran_Ngoc_-_SD0585Thuy_Tran_Ngoc_-_SD0585
Thuy_Tran_Ngoc_-_SD0585
 
E xtreme programming for etl and data analytics final
E xtreme programming for etl and data analytics finalE xtreme programming for etl and data analytics final
E xtreme programming for etl and data analytics final
 
How to test a Mainframe Application
How to test a Mainframe ApplicationHow to test a Mainframe Application
How to test a Mainframe Application
 
Introducing Agile Methodologies
Introducing Agile MethodologiesIntroducing Agile Methodologies
Introducing Agile Methodologies
 
SbE - Requirements in an agile process
SbE - Requirements in an agile processSbE - Requirements in an agile process
SbE - Requirements in an agile process
 
Introduction to Agile Software Development Process
Introduction to Agile Software Development ProcessIntroduction to Agile Software Development Process
Introduction to Agile Software Development Process
 
Bilbostack19 devops is not what you think
Bilbostack19 devops is not what you thinkBilbostack19 devops is not what you think
Bilbostack19 devops is not what you think
 
devops, microservices, and platforms, oh my!
devops, microservices, and platforms, oh my!devops, microservices, and platforms, oh my!
devops, microservices, and platforms, oh my!
 
Cloud Foundry Summit 2015: Devops, microservices and platforms, oh my!
Cloud Foundry Summit 2015: Devops, microservices and platforms, oh my!Cloud Foundry Summit 2015: Devops, microservices and platforms, oh my!
Cloud Foundry Summit 2015: Devops, microservices and platforms, oh my!
 
Agile Testing - What is it?
Agile Testing - What is it?Agile Testing - What is it?
Agile Testing - What is it?
 
Agile Testing
Agile Testing  Agile Testing
Agile Testing
 
Lessons Learned from Large Scale Adoption of DevOps for IBM z Systems Software
Lessons Learned from Large Scale Adoption of DevOps for IBM z Systems SoftwareLessons Learned from Large Scale Adoption of DevOps for IBM z Systems Software
Lessons Learned from Large Scale Adoption of DevOps for IBM z Systems Software
 
apidays LIVE New York - Navigating the Sea of Javascript Tools to Discover Sc...
apidays LIVE New York - Navigating the Sea of Javascript Tools to Discover Sc...apidays LIVE New York - Navigating the Sea of Javascript Tools to Discover Sc...
apidays LIVE New York - Navigating the Sea of Javascript Tools to Discover Sc...
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
 
DevOps Game at SGZA
DevOps Game at SGZADevOps Game at SGZA
DevOps Game at SGZA
 

Recently uploaded

WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...FIDO Alliance
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024Stephanie Beckett
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfFIDO Alliance
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!Memoori
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessUXDXConf
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform EngineeringMarcus Vechiato
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfFIDO Alliance
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxJennifer Lim
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Hiroshi SHIBATA
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsStefano
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentationyogeshlabana357357
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024Lorenzo Miniero
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaCzechDreamin
 
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxBT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxNeo4j
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty SecureFemke de Vroome
 

Recently uploaded (20)

WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxBT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 

BizSpark SF Lightning Talk: "Refactoring and Test-Driven Development" by Mathias Brandewinder

  • 1. What is TDD? (answer: Test-Driven Development) … and why you should care Clear Lines Consulting · clear-lines.com 11/8/2011 · 1
  • 2. Once upon a Time… Design Implement Test Clear Lines Consulting · clear-lines.com 11/8/2011 · 2
  • 3. Stay buggy, my friends! Clear Lines Consulting · clear-lines.com 11/8/2011 · 3
  • 4. Start with the tests! If I needed to Add 1 + 1… Clear Lines Consulting · clear-lines.com 11/8/2011 · 4
  • 5. If I needed to Add 1 + 1… [Test] public void When_Adding_One_Plus_One_Answer_Should_Be_Two() { // Assert var expectedResult = 2; Assert.That(actualResult, Is.EqualTo(expectedResult)); } … I would expect the answer to be 2 Clear Lines Consulting · clear-lines.com 11/8/2011 · 5
  • 6. If I needed to Add 1 + 1… [Test] public void When_Adding_One_Plus_One_Answer_Should_Be_Two() { // Act var actualResult = calculator.Add(1, 1); // Assert var expectedResult = 2; Assert.That(actualResult, Is.EqualTo(expectedResult)); } … I would need a Calculator Clear Lines Consulting · clear-lines.com 11/8/2011 · 6
  • 7. If I needed to Add 1 + 1… [Test] public void When_Adding_One_Plus_One_Answer_Should_Be_Two() { // Arrange var calculator = new Calculator(); // Act var actualResult = calculator.Add(1, 1); // Assert var expectedResult = 2; Assert.That(actualResult, Is.EqualTo(expectedResult)); } … I would need some code Clear Lines Consulting · clear-lines.com 11/8/2011 · 7
  • 8. If I needed to Add 1 + 1… … Does the code work? Clear Lines Consulting · clear-lines.com 11/8/2011 · 8
  • 9. Testing frameworks MsTest Clear Lines Consulting · clear-lines.com 11/8/2011 · 9
  • 10. It’s not about Testing » It’s about writing Code that works, now » Imagine you had implemented the feature » … then implement it » Rinse & Repeat until you have no test to write Clear Lines Consulting · clear-lines.com 11/8/2011 · 10
  • 11. Why should you care? Clear Lines Consulting · clear-lines.com 11/8/2011 · 11
  • 12. The dreaded L word © www.dilbert.com Clear Lines Consulting · clear-lines.com 11/8/2011 · 12
  • 13. “To me, legacy code is simply code without tests.” Michael Feathers, Working Effectively with Legacy Code Clear Lines Consulting · clear-lines.com 11/8/2011 · 13
  • 14. Did I break everything? Clear Lines Consulting · clear-lines.com 11/8/2011 · 14
  • 15. Tests: a Vise holding your code steady Clear Lines Consulting · clear-lines.com 11/8/2011 · 15
  • 16. A good test is » Fast » Focused » Replicable » Automated Clear Lines Consulting · clear-lines.com 11/8/2011 · 16
  • 17. Refactoring: improve the code structure, without changing its external behavior. Clear Lines Consulting · clear-lines.com 11/8/2011 · 17
  • 18. Red, Green, Refactor » Red: write a little test that doesn’t work » Green: make the test work quickly » Refactor: cleanup time! Clear Lines Consulting · clear-lines.com 11/8/2011 · 18
  • 19. Test-Driven Development is a way of managing fear during programming. Kent Beck, Test-Driven Development by Example Clear Lines Consulting · clear-lines.com 11/8/2011 · 19
  • 20. The Cast » Me: Mathias Brandewinder – mathias@clear-lines.com (clear-lines.com/blog) » Frameworks/Tools – NUnit: www.nunit.org – xUnit: xunit.codeplex.com/ – Resharper: www.jetbrains.com/resharper/ » Books – Kent Beck, “Test Driven Development by Example” – Michael Feathers, “Working Effectively with Legacy Code” – Roy Osherove, “The Art of Unit Testing” Clear Lines Consulting · clear-lines.com 11/8/2011 · 20