SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

Similar a 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
 
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
 
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
 
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 a 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
 
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!
 
devops, microservices, and platforms, oh my!
devops, microservices, and platforms, oh my!devops, microservices, and platforms, oh my!
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
 

Último

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
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
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
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
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
 
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
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 

Último (20)

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...
 
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?
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
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
 
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...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

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