SlideShare a Scribd company logo
1 of 23
Download to read offline
 It’s not about testing, but about design
  and development(specification).
 Short development iteration.
 Is a design process.
 Based on requirement and pre-written test.
 Tests are your first user.
 The goal is to produce working clean
  code, that fullfill the requirement.
 If TDD hurt you, that mean you do it wrong.
   Write Test Code
       Code that fulfills requirements
   Write Functional Code
       Working code that fulfills requirements
   Refactor
       Clean working code that fulfills requirements
 Unneccessary Code, features or
  functionality.
 Unchangeable code.
 Unscallable code.
 Carefully plan
 Make the change
 Start the application and check the
  change
 Poking aroud
 Write test
 Make the change
 Run all tests
The pain is here!          This is too late…
                    100%                                                                     10
                                                                                             9
                    80%                                                                      8
% defects created




                                                                                             7




                                                                                                  Thousand $s
                    60%                                                                      6
                                                                                             5
                    40%                                                                      4
                                                                                             3
                    20%                                                                      2
                                                                                             1
                     0%                                                                      0
                           Requirements   Coding    Integration       Testing      Support

                                  % of Defects Introduced         Cost to Fix a Defect
   Make you think about requirement
    behaviour.
   Provide documentation.
   Improve quality.
   Reduce speculative code.
   Less time debuggin.
• Confidence in change, Fearlessly change your
    code
   Discover usablity issue early
   Regression testing = Stable software =
    Quality software
 I don’t have time to unit test.
 The client pays me to develop code, not
  write unit test.
 I am supporting a legacy application
  without unit tests.
 QA and User Acceptance Testing is far
  more effective in finding bugs.
 I don’t know how to unit test, or I don’t
  know how to write good unit tests.
 It forces you to really understand the
  code.
 It forces you to really understand the
  tests
 It forces you to create code that is truly
  reusable and modular and testable
 These forces drive you to keep your
  code and your tests simple and easy to
  understand.
 Enabling TDD
 TDD Cycle
 Choosing the First Test?
 Green Bar Patterns
 State-based vs. Interaction-based Unit
  Testing
   NUnit          Resharper
   MbUnit         TDD.NET
   JUnit
                   RefactorPro!
   JSSpec
   xUnit.net      Visual Studio
   Moq
   Rhino Mocks
   Mosquito
New
                        requireme
                            nt


                                             Write
    Run tests
                                            new test




Refactor                                        Run tests




                                    Write
            Run tests               new
                                    code
 The simplest.
 The essence.
    •If you need to write code that is
    untested, choose a simpler test.
    •If the essence approach takes to much
    time to implement, choose a simpler
    test.
Do not
write the code in your head
 before you write the test
 Small and focused
 Intention revealing
 Repeatable
 Independent
 Have no side-effects
•Domain-specific
•Suitable for customer comprehension
•Understandable in absence of code



•Think about behavior
•Think about the context of the
behavior
•Focus on the words, not the
implementation
   Fake It(TilYou Make It)
       Start with hardcoded results and wait until later
        tests to force them to become real.
   Triangulate To Abstraction
       Make the code abstract only when you have
        two or more examples.
   Obvious Implementation
       aka Don't Be Stupid
       If you really, really, honestly know the right way
        to implement it, then write it that way.
TDD sharevison team

More Related Content

Viewers also liked (8)

Clean code
Clean codeClean code
Clean code
 
Aao ichapter11
Aao ichapter11Aao ichapter11
Aao ichapter11
 
An Apocalypse of Ice; chapter 3
An Apocalypse of Ice; chapter 3An Apocalypse of Ice; chapter 3
An Apocalypse of Ice; chapter 3
 
Apocalypse of Ice Chapter 12 Part 1
Apocalypse of Ice Chapter 12 Part 1Apocalypse of Ice Chapter 12 Part 1
Apocalypse of Ice Chapter 12 Part 1
 
Flex_rest_optimization
Flex_rest_optimizationFlex_rest_optimization
Flex_rest_optimization
 
Share Vision First Trip
Share Vision First TripShare Vision First Trip
Share Vision First Trip
 
An Apocalypse of Ice; chapter 7
An Apocalypse of Ice; chapter 7An Apocalypse of Ice; chapter 7
An Apocalypse of Ice; chapter 7
 
Will bc day3
Will bc day3Will bc day3
Will bc day3
 

Similar to TDD sharevison team

Benefit From Unit Testing In The Real World
Benefit From Unit Testing In The Real WorldBenefit From Unit Testing In The Real World
Benefit From Unit Testing In The Real World
Dror Helper
 
PHX - Session #2 Test Driven Development: Improving .NET Application Performa...
PHX - Session #2 Test Driven Development: Improving .NET Application Performa...PHX - Session #2 Test Driven Development: Improving .NET Application Performa...
PHX - Session #2 Test Driven Development: Improving .NET Application Performa...
Steve Lange
 
Test-Driven Development Reference Card
Test-Driven Development Reference CardTest-Driven Development Reference Card
Test-Driven Development Reference Card
Seapine Software
 
Automating good coding practices
Automating good coding practicesAutomating good coding practices
Automating good coding practices
Kevin Peterson
 

Similar to TDD sharevison team (20)

Test-Driven Development (TDD)
Test-Driven Development (TDD)Test-Driven Development (TDD)
Test-Driven Development (TDD)
 
Benefit From Unit Testing In The Real World
Benefit From Unit Testing In The Real WorldBenefit From Unit Testing In The Real World
Benefit From Unit Testing In The Real World
 
Unit testing - An introduction
Unit testing - An introductionUnit testing - An introduction
Unit testing - An introduction
 
Defect prevention
Defect preventionDefect prevention
Defect prevention
 
PHX - Session #2 Test Driven Development: Improving .NET Application Performa...
PHX - Session #2 Test Driven Development: Improving .NET Application Performa...PHX - Session #2 Test Driven Development: Improving .NET Application Performa...
PHX - Session #2 Test Driven Development: Improving .NET Application Performa...
 
End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020
 
Test-driven Development Practices in White Box Test Automation
Test-driven Development Practices in White Box Test AutomationTest-driven Development Practices in White Box Test Automation
Test-driven Development Practices in White Box Test Automation
 
Bridging the communication Gap & Continuous Delivery
Bridging the communication Gap & Continuous DeliveryBridging the communication Gap & Continuous Delivery
Bridging the communication Gap & Continuous Delivery
 
Test-Driven Development Reference Card
Test-Driven Development Reference CardTest-Driven Development Reference Card
Test-Driven Development Reference Card
 
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
 
Future of QA
Future of QAFuture of QA
Future of QA
 
Futureofqa
FutureofqaFutureofqa
Futureofqa
 
Backward thinking design qa system for quality goals
Backward thinking   design qa system for quality goalsBackward thinking   design qa system for quality goals
Backward thinking design qa system for quality goals
 
Agile testing
Agile testingAgile testing
Agile testing
 
Automating good coding practices
Automating good coding practicesAutomating good coding practices
Automating good coding practices
 
Selenium DeTox for Achieving the Right Testing Pyramid
Selenium DeTox for Achieving the Right Testing PyramidSelenium DeTox for Achieving the Right Testing Pyramid
Selenium DeTox for Achieving the Right Testing Pyramid
 
Abc of testing
Abc of testingAbc of testing
Abc of testing
 
A journey to_be_a_software_craftsman
A journey to_be_a_software_craftsmanA journey to_be_a_software_craftsman
A journey to_be_a_software_craftsman
 
Test Policy and Practices
Test Policy and PracticesTest Policy and Practices
Test Policy and Practices
 
Tec314f
Tec314fTec314f
Tec314f
 

Recently uploaded

Asli Kala jadu, Black magic specialist in Pakistan Or Kala jadu expert in Egy...
Asli Kala jadu, Black magic specialist in Pakistan Or Kala jadu expert in Egy...Asli Kala jadu, Black magic specialist in Pakistan Or Kala jadu expert in Egy...
Asli Kala jadu, Black magic specialist in Pakistan Or Kala jadu expert in Egy...
baharayali
 
🔝|97111༒99012🔝 Call Girls In {Delhi} Cr Park ₹5.5k Cash Payment With Room De...
🔝|97111༒99012🔝 Call Girls In  {Delhi} Cr Park ₹5.5k Cash Payment With Room De...🔝|97111༒99012🔝 Call Girls In  {Delhi} Cr Park ₹5.5k Cash Payment With Room De...
🔝|97111༒99012🔝 Call Girls In {Delhi} Cr Park ₹5.5k Cash Payment With Room De...
Diya Sharma
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Recently uploaded (20)

Croatia vs Italy Euro Cup 2024 Three pitfalls for Spalletti’s Italy in Group ...
Croatia vs Italy Euro Cup 2024 Three pitfalls for Spalletti’s Italy in Group ...Croatia vs Italy Euro Cup 2024 Three pitfalls for Spalletti’s Italy in Group ...
Croatia vs Italy Euro Cup 2024 Three pitfalls for Spalletti’s Italy in Group ...
 
Who Is Emmanuel Katto Uganda? His Career, personal life etc.
Who Is Emmanuel Katto Uganda? His Career, personal life etc.Who Is Emmanuel Katto Uganda? His Career, personal life etc.
Who Is Emmanuel Katto Uganda? His Career, personal life etc.
 
Asli Kala jadu, Black magic specialist in Pakistan Or Kala jadu expert in Egy...
Asli Kala jadu, Black magic specialist in Pakistan Or Kala jadu expert in Egy...Asli Kala jadu, Black magic specialist in Pakistan Or Kala jadu expert in Egy...
Asli Kala jadu, Black magic specialist in Pakistan Or Kala jadu expert in Egy...
 
Netherlands Players expected to miss UEFA Euro 2024 due to injury.docx
Netherlands Players expected to miss UEFA Euro 2024 due to injury.docxNetherlands Players expected to miss UEFA Euro 2024 due to injury.docx
Netherlands Players expected to miss UEFA Euro 2024 due to injury.docx
 
Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...
Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...
Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...
 
Technical Data | Sig Sauer Easy6 BDX 1-6x24 | Optics Trade
Technical Data | Sig Sauer Easy6 BDX 1-6x24 | Optics TradeTechnical Data | Sig Sauer Easy6 BDX 1-6x24 | Optics Trade
Technical Data | Sig Sauer Easy6 BDX 1-6x24 | Optics Trade
 
🔝|97111༒99012🔝 Call Girls In {Delhi} Cr Park ₹5.5k Cash Payment With Room De...
🔝|97111༒99012🔝 Call Girls In  {Delhi} Cr Park ₹5.5k Cash Payment With Room De...🔝|97111༒99012🔝 Call Girls In  {Delhi} Cr Park ₹5.5k Cash Payment With Room De...
🔝|97111༒99012🔝 Call Girls In {Delhi} Cr Park ₹5.5k Cash Payment With Room De...
 
Personal Brand Exploration - By Bradley Dennis
Personal Brand Exploration - By Bradley DennisPersonal Brand Exploration - By Bradley Dennis
Personal Brand Exploration - By Bradley Dennis
 
UEFA Euro 2024 Squad Check-in Who is Most Favorite.docx
UEFA Euro 2024 Squad Check-in Who is Most Favorite.docxUEFA Euro 2024 Squad Check-in Who is Most Favorite.docx
UEFA Euro 2024 Squad Check-in Who is Most Favorite.docx
 
WhatsApp Chat: 📞 8617697112 Birbhum Call Girl available for hotel room package
WhatsApp Chat: 📞 8617697112 Birbhum  Call Girl available for hotel room packageWhatsApp Chat: 📞 8617697112 Birbhum  Call Girl available for hotel room package
WhatsApp Chat: 📞 8617697112 Birbhum Call Girl available for hotel room package
 
JORNADA 5 LIGA MURO 2024INSUGURACION.pdf
JORNADA 5 LIGA MURO 2024INSUGURACION.pdfJORNADA 5 LIGA MURO 2024INSUGURACION.pdf
JORNADA 5 LIGA MURO 2024INSUGURACION.pdf
 
Hire 💕 8617697112 Kasauli Call Girls Service Call Girls Agency
Hire 💕 8617697112 Kasauli Call Girls Service Call Girls AgencyHire 💕 8617697112 Kasauli Call Girls Service Call Girls Agency
Hire 💕 8617697112 Kasauli Call Girls Service Call Girls Agency
 
Spain Vs Italy Spain to be banned from participating in Euro 2024.docx
Spain Vs Italy Spain to be banned from participating in Euro 2024.docxSpain Vs Italy Spain to be banned from participating in Euro 2024.docx
Spain Vs Italy Spain to be banned from participating in Euro 2024.docx
 
Spain Vs Albania- Spain at risk of being thrown out of Euro 2024 with Tournam...
Spain Vs Albania- Spain at risk of being thrown out of Euro 2024 with Tournam...Spain Vs Albania- Spain at risk of being thrown out of Euro 2024 with Tournam...
Spain Vs Albania- Spain at risk of being thrown out of Euro 2024 with Tournam...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Sports Writing (Rules,Tips, Examples, etc)
Sports Writing (Rules,Tips, Examples, etc)Sports Writing (Rules,Tips, Examples, etc)
Sports Writing (Rules,Tips, Examples, etc)
 
Ramban Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts In...
Ramban  Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts In...Ramban  Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts In...
Ramban Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts In...
 
Slovenia Vs Serbia UEFA Euro 2024 Fixture Guide Every Fixture Detailed.docx
Slovenia Vs Serbia UEFA Euro 2024 Fixture Guide Every Fixture Detailed.docxSlovenia Vs Serbia UEFA Euro 2024 Fixture Guide Every Fixture Detailed.docx
Slovenia Vs Serbia UEFA Euro 2024 Fixture Guide Every Fixture Detailed.docx
 
Trossard's Message Bridging Celebrities and Sports in Euro Cup 2024.docx
Trossard's Message Bridging Celebrities and Sports in Euro Cup 2024.docxTrossard's Message Bridging Celebrities and Sports in Euro Cup 2024.docx
Trossard's Message Bridging Celebrities and Sports in Euro Cup 2024.docx
 
Unveiling the Mystery of Main Bazar Chart
Unveiling the Mystery of Main Bazar ChartUnveiling the Mystery of Main Bazar Chart
Unveiling the Mystery of Main Bazar Chart
 

TDD sharevison team

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.  It’s not about testing, but about design and development(specification).  Short development iteration.  Is a design process.  Based on requirement and pre-written test.  Tests are your first user.  The goal is to produce working clean code, that fullfill the requirement.  If TDD hurt you, that mean you do it wrong.
  • 6. Write Test Code  Code that fulfills requirements  Write Functional Code  Working code that fulfills requirements  Refactor  Clean working code that fulfills requirements
  • 7.  Unneccessary Code, features or functionality.  Unchangeable code.  Unscallable code.
  • 8.  Carefully plan  Make the change  Start the application and check the change  Poking aroud
  • 9.  Write test  Make the change  Run all tests
  • 10. The pain is here! This is too late… 100% 10 9 80% 8 % defects created 7 Thousand $s 60% 6 5 40% 4 3 20% 2 1 0% 0 Requirements Coding Integration Testing Support % of Defects Introduced Cost to Fix a Defect
  • 11. Make you think about requirement behaviour.  Provide documentation.  Improve quality.  Reduce speculative code.  Less time debuggin. • Confidence in change, Fearlessly change your code  Discover usablity issue early  Regression testing = Stable software = Quality software
  • 12.  I don’t have time to unit test.  The client pays me to develop code, not write unit test.  I am supporting a legacy application without unit tests.  QA and User Acceptance Testing is far more effective in finding bugs.  I don’t know how to unit test, or I don’t know how to write good unit tests.
  • 13.  It forces you to really understand the code.  It forces you to really understand the tests  It forces you to create code that is truly reusable and modular and testable  These forces drive you to keep your code and your tests simple and easy to understand.
  • 14.  Enabling TDD  TDD Cycle  Choosing the First Test?  Green Bar Patterns  State-based vs. Interaction-based Unit Testing
  • 15. NUnit  Resharper  MbUnit  TDD.NET  JUnit  RefactorPro!  JSSpec  xUnit.net  Visual Studio  Moq  Rhino Mocks  Mosquito
  • 16. New requireme nt Write Run tests new test Refactor Run tests Write Run tests new code
  • 17.  The simplest.  The essence. •If you need to write code that is untested, choose a simpler test. •If the essence approach takes to much time to implement, choose a simpler test.
  • 18. Do not write the code in your head before you write the test
  • 19.  Small and focused  Intention revealing  Repeatable  Independent  Have no side-effects
  • 20. •Domain-specific •Suitable for customer comprehension •Understandable in absence of code •Think about behavior •Think about the context of the behavior •Focus on the words, not the implementation
  • 21.
  • 22. Fake It(TilYou Make It)  Start with hardcoded results and wait until later tests to force them to become real.  Triangulate To Abstraction  Make the code abstract only when you have two or more examples.  Obvious Implementation  aka Don't Be Stupid  If you really, really, honestly know the right way to implement it, then write it that way.