SlideShare a Scribd company logo
Test Driven Development
Email (samnang.chhun@gmail.com)
Blog (http://tech.wowkhmer.com)
Rails Developer
.NET Developer
Test Driven Development
Test Driven Development
About Testing!
Test Last or DDD (Design Driven Tests)
Short development iterations
Is a design process
Based on requirement and pre-written test
cases
Tests are your first users
The goal is to produce working clean code that
fulfills requirements
If TDD hurts then you're doing it wrong
Unnecessary Codes
Unchangeable Codes
Unintelligible Code
Makes you think about required behavior.
Provides documentation.
Improves quality.
Reduces speculative code.
Less time debugging.
Confidence in change
Discover usability issues early
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
VSTS          Refactor Pro!
xUnit.net     Visual Studio
Moq
Rhino Mocks
create a
              failing
               test




 remove                   write
duplicatio                 just
 n clarify              enough
  intent                 to pass
RED




Refactor         Green
Test Driven Development
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.
Small and focused
Intention revealing
Repeatable
Independent
Have no side-effects
Description should be
• Domain-specific
• Suitable for customer comprehension
• Understandable in absence of code
Writing descriptions
• Think about behavior
• Think about the context of the behavior
• Focus on the words, not the implementation
Test Driven Development
Fake It(Til You 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.
Test Driven Development
Test Driven Development

More Related Content

PPTX
The problem with tdd
PPTX
Advanced unit testing – real life examples and mistakes
PPTX
Real Life Unit Testing
PDF
Alexandru Bolboaca - Unit Testing from the Trenches
PDF
Code Review Matters and Manners
PPTX
Level Up Your Automated Tests
PDF
TDD — Are you sure you properly test code?
PPTX
clean code - uncle bob
The problem with tdd
Advanced unit testing – real life examples and mistakes
Real Life Unit Testing
Alexandru Bolboaca - Unit Testing from the Trenches
Code Review Matters and Manners
Level Up Your Automated Tests
TDD — Are you sure you properly test code?
clean code - uncle bob

What's hot (20)

PPT
Best Practices of Software Development
PPTX
2013 09-11 java zone - extreme programming live
PDF
Level Up Your Automated Tests
PDF
Test-Driven Development Reference Card
PPTX
Clean code
PPTX
Test Driven Development
PPTX
Code Review
PPTX
Test Driven Development
PPTX
Test-Driven Development
PPTX
Type mock isolator
PPTX
Roy Osherove TDD From Scratch
PPTX
Best pratice
PPTX
Training methdology testers to developers
PPTX
A Brief Introduction to Test-Driven Development
PPTX
Code Review Best Practices
PPTX
Lập trình hướng kiểm thử - Test Driven development
PDF
Testing 101: Three Rules for Testing at Ombu Labs
PDF
YAGNI Principle and Clean Code
PPTX
TDD- Test Driven Development
PPTX
Good Unit Tests Ask For Quality Code
Best Practices of Software Development
2013 09-11 java zone - extreme programming live
Level Up Your Automated Tests
Test-Driven Development Reference Card
Clean code
Test Driven Development
Code Review
Test Driven Development
Test-Driven Development
Type mock isolator
Roy Osherove TDD From Scratch
Best pratice
Training methdology testers to developers
A Brief Introduction to Test-Driven Development
Code Review Best Practices
Lập trình hướng kiểm thử - Test Driven development
Testing 101: Three Rules for Testing at Ombu Labs
YAGNI Principle and Clean Code
TDD- Test Driven Development
Good Unit Tests Ask For Quality Code
Ad

Similar to Test Driven Development (20)

PPTX
Ian Cooper webinar for DDD Iran: Kent beck style tdd seven years after
PPTX
Intro to TDD
PPT
Automated Unit Testing and TDD
PPT
Test Driven Development
PPTX
Software Development Essential Skills
PPT
Introduction to Test Driven Development
PDF
Test-Driven Development
PDF
TDD and Simple Design Workshop - Session 1 - March 2019
PPTX
Understanding Why Testing is Importaint
PPTX
TDD in Agile
PDF
Pairing w developers_stpconpics
PPT
Introduction to test programming
PPTX
Test Driven Development
PPT
Agile Methodologies And Extreme Programming - Svetlin Nakov
PPTX
Unit testing
PPTX
Test Driven Development with Laravel
PPT
Agile Methodologies And Extreme Programming
PDF
TDD for Testers Workshop
PPT
Test Driven Development - Overview and Adoption
Ian Cooper webinar for DDD Iran: Kent beck style tdd seven years after
Intro to TDD
Automated Unit Testing and TDD
Test Driven Development
Software Development Essential Skills
Introduction to Test Driven Development
Test-Driven Development
TDD and Simple Design Workshop - Session 1 - March 2019
Understanding Why Testing is Importaint
TDD in Agile
Pairing w developers_stpconpics
Introduction to test programming
Test Driven Development
Agile Methodologies And Extreme Programming - Svetlin Nakov
Unit testing
Test Driven Development with Laravel
Agile Methodologies And Extreme Programming
TDD for Testers Workshop
Test Driven Development - Overview and Adoption
Ad

More from Samnang Chhun (10)

PDF
Find your passion
PDF
Software developer career growth
PDF
Why i love ruby than x
PDF
12 Things Every Programmer Should Know
PPTX
The visitor design pattern
PDF
Peforming Code Katas
PDF
Introduction To Share Vision
PDF
Version Control With Subversion
PPTX
Layering
PDF
NHibernate (The ORM For .NET Platform)
Find your passion
Software developer career growth
Why i love ruby than x
12 Things Every Programmer Should Know
The visitor design pattern
Peforming Code Katas
Introduction To Share Vision
Version Control With Subversion
Layering
NHibernate (The ORM For .NET Platform)

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Empathic Computing: Creating Shared Understanding
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Encapsulation theory and applications.pdf
PPTX
Cloud computing and distributed systems.
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Electronic commerce courselecture one. Pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
cuic standard and advanced reporting.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Network Security Unit 5.pdf for BCA BBA.
NewMind AI Weekly Chronicles - August'25 Week I
sap open course for s4hana steps from ECC to s4
Empathic Computing: Creating Shared Understanding
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Per capita expenditure prediction using model stacking based on satellite ima...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Encapsulation theory and applications.pdf
Cloud computing and distributed systems.
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Reach Out and Touch Someone: Haptics and Empathic Computing
Electronic commerce courselecture one. Pdf
Programs and apps: productivity, graphics, security and other tools
20250228 LYD VKU AI Blended-Learning.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Understanding_Digital_Forensics_Presentation.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
cuic standard and advanced reporting.pdf
Big Data Technologies - Introduction.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Network Security Unit 5.pdf for BCA BBA.

Test Driven Development

  • 5. About Testing! Test Last or DDD (Design Driven Tests)
  • 6. Short development iterations Is a design process Based on requirement and pre-written test cases Tests are your first users The goal is to produce working clean code that fulfills requirements If TDD hurts then you're doing it wrong
  • 8. Makes you think about required behavior. Provides documentation. Improves quality. Reduces speculative code. Less time debugging. Confidence in change Discover usability issues early
  • 9. 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.
  • 10. 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.
  • 11. Enabling TDD TDD Cycle Choosing the First Test? Green Bar Patterns State-based vs. Interaction-based Unit Testing
  • 12. NUnit Resharper MbUnit TDD.NET VSTS Refactor Pro! xUnit.net Visual Studio Moq Rhino Mocks
  • 13. create a failing test remove write duplicatio just n clarify enough intent to pass
  • 14. RED Refactor Green
  • 16. 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.
  • 17. Small and focused Intention revealing Repeatable Independent Have no side-effects
  • 18. Description should be • Domain-specific • Suitable for customer comprehension • Understandable in absence of code Writing descriptions • Think about behavior • Think about the context of the behavior • Focus on the words, not the implementation
  • 20. Fake It(Til You 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.