SlideShare a Scribd company logo
Intro to Test Driven Development (TDD) 
Consulting/Training
Consulting/Training 
About Me 
๏‚— Microsoft Client Development MVP 
๏‚— ASPInsider 
๏‚— Twitter: @joelcochran 
๏‚— Email: joelcochran@gmail.com 
๏‚— Blog: joelcochran.com 
๏‚— Lead Developer, WintellectNOW
Consulting/Training 
About Wintellect 
Founded by top experts on Microsoft โ€“ Jeffrey Richter, Jeff Prosise, and John Robbins โ€“ we pull out all the stops 
to help our customers achieve their goals through advanced software-based consulting and training solutions. 
consulting 
Wintellect helps you build better software, faster, 
tackling the tough projects and solving the software 
and technology questions that help you transform 
your business. 
๏‚— Architecture, Analysis and Design 
๏‚— Full lifecycle software development 
๏‚— Debugging and Performance tuning 
๏‚— Database design and development 
training 
Wintellect's courses are written and taught by some of 
the biggest and most respected names in the Microsoft 
programming industry. 
๏‚— Learn from the best. Access the same training 
Microsoftโ€™s developers enjoy 
๏‚— Real world knowledge and solutions on both current 
and cutting edge technologies 
๏‚— Flexibility in training options โ€“ onsite, virtual, on 
demand 
who we are
Wintellectโ€™s On-Demand Video Training Solution 
Try it free 
Code: <INSERT CODE HERE> WintellectNOW.com 
COCHRAN-13 
Authors Enjoy: 
๏‚— Royalty Income 
๏‚— Personal Branding 
๏‚— Cross-Sell Opps 
๏‚— Free library access 
Subscribers Enjoy: 
๏‚— Expert Instructors 
๏‚— Quality Content 
๏‚— Practical Application 
๏‚— All Devices 
Consulting/Training Individuals | Businesses | Enterprise Organizations
Interview with a Method 
Consulting/Training
The Multiply Method Signature 
Int32 Multiply(Int32[] values) 
Consulting/Training
Consulting/Training 
Question #1 
What parameter(s) do you take? 
An Array of Int32
Consulting/Training 
Question #2 
What value type do you return? 
Int32
Consulting/Training 
Question #3 
What happens when I pass you: 
[3, 4]? 
I donโ€™t know
Consulting/Training 
Question #4 
What happens when I pass you: 
[7]? 
I donโ€™t know
Consulting/Training 
Question #5 
What happens when I pass you: 
[-5, 12, 10, -3]? 
I donโ€™t know
Consulting/Training 
Question #6 
What happens when I pass you: 
null? 
I donโ€™t know
Consulting/Training 
Question #7 
What happens when I pass you: 
[23, Int32.MaxValue]? 
I donโ€™t know
Consulting/Training 
Question #8 
You donโ€™t seem to know muchโ€ฆ 
If you donโ€™t know the answer to these 
questions, who does? 
The Unit Tests
Consulting/Training 
What is a Unit Test? 
๏‚— Code that tests code 
๏‚— Small discrete chunks (units) 
๏‚— One test, one condition 
๏‚— Based on assumptions 
๏‚— Should be automated and repeatable
What a Unit Test is Not 
Consulting/Training 
๏‚— An end-to-end test 
๏‚— Connected to live data 
๏‚— Performing external functions (like sending an Email) 
๏‚— User tests
Consulting/Training 
Why write Unit Tests? 
๏‚— Test code to ensure proper functionality given certain assumptions 
๏‚— Exercise code without running the app 
๏‚— Write once, run a million times 
๏‚— Guards against unintended consequences 
๏‚— Tests define success
Consulting/Training 
What is TDD? 
๏‚— Unit Tests are written before the code 
๏‚— Helps shape the code to the task at hand 
๏‚— Provides focus (YAGNI) 
๏‚— The test defines success 
๏‚— Run all tests every time
Consulting/Training 
TDD Pattern 
RED 
write a failing test 
GREEN 
write enough code 
to pass 
REFACTOR 
engineer the code
Anatomy of a Unit Test 
Consulting/Training 
Arrange 
โ€ข Assumptions 
โ€ข Expectations 
Act 
โ€ข Execute 
โ€ข Results 
Assert 
โ€ข Compare 
โ€ข Report
Consulting/Training 
TDD Kata 
๏‚— Daily exercise โ€“ 30 minutes or less 
๏‚— Roy Osherove, author of โ€œThe Art of Unit Testingโ€, Manning 
Publications 
๏‚— http://osherove.com/tdd-kata-1/ 
๏‚— Letโ€™s code!
The String Calculator Kata 
Consulting/Training
Consulting/Training 
StringCalculator Kata
Consulting/Training 
Questions? 
joelcochran@gmail.com

More Related Content

What's hot (19)

DOCX
Mca5020 advanced software engineering-de
smumbahelp
ย 
PPTX
Test Driven Development
Josh Candish
ย 
PDF
Programming interview preparation
bigdata trunk
ย 
PPTX
Level Up Your Automated Tests
Trisha Gee
ย 
PPTX
2013 09-11 java zone - extreme programming live
Johannes Brodwall
ย 
PDF
Agile Testing 20021015
Raghu Karnati
ย 
PDF
Should you be your own judge?
Achyut Pokhrel
ย 
PDF
Level Up Your Automated Tests
Trisha Gee
ย 
PPTX
(A)TDD The what, why and how
Alexander van Trijffel
ย 
PPT
Introduction to Test Driven Development
Michael Denomy
ย 
PPTX
Agile and ATDD the perfect couple
Stephen Tucker
ย 
PPTX
TDD talk
Robert Dyball
ย 
PDF
Refactoring legacy code
Pablo Neves Machado
ย 
PPTX
Pair programming and introduction to TDD
Arati Joshi
ย 
PDF
Design talk
Kate Hanson
ย 
PDF
TDD and more than 9000 tries to sell it to a customer
Anuar Nurmakanov
ย 
PPTX
Istqb foundation level
Le Trung Hieu
ย 
PPTX
Stop fearing legacy code
Yaki Koren
ย 
ODP
Xtreme Programming
Prasad Kancharla
ย 
Mca5020 advanced software engineering-de
smumbahelp
ย 
Test Driven Development
Josh Candish
ย 
Programming interview preparation
bigdata trunk
ย 
Level Up Your Automated Tests
Trisha Gee
ย 
2013 09-11 java zone - extreme programming live
Johannes Brodwall
ย 
Agile Testing 20021015
Raghu Karnati
ย 
Should you be your own judge?
Achyut Pokhrel
ย 
Level Up Your Automated Tests
Trisha Gee
ย 
(A)TDD The what, why and how
Alexander van Trijffel
ย 
Introduction to Test Driven Development
Michael Denomy
ย 
Agile and ATDD the perfect couple
Stephen Tucker
ย 
TDD talk
Robert Dyball
ย 
Refactoring legacy code
Pablo Neves Machado
ย 
Pair programming and introduction to TDD
Arati Joshi
ย 
Design talk
Kate Hanson
ย 
TDD and more than 9000 tries to sell it to a customer
Anuar Nurmakanov
ย 
Istqb foundation level
Le Trung Hieu
ย 
Stop fearing legacy code
Yaki Koren
ย 
Xtreme Programming
Prasad Kancharla
ย 

Viewers also liked (18)

PDF
Software Testing and Quality Assurance Assignment 2
Gurpreet singh
ย 
DOC
Seeking Assignments in QA/QC , Project Site , Piping Welding/Fabrication , In...
Shadab Haider Zaidi
ย 
PDF
Software Testing and Quality Assurance Assignment 3
Gurpreet singh
ย 
PDF
Software Testing Interview Q&A โ€“ part 1
Khoa Bui
ย 
DOC
Multiplateform testing
Gurpreet singh
ย 
PDF
Fundamentals of Testing 2
Hoang Nguyen
ย 
PDF
Software project management
Saumya Sahu
ย 
DOCX
Some Commonly Asked Question For Software Testing
Kumari Warsha Goel
ย 
DOCX
Fresher interview question for software testing (QA) manual + basic automation
Rakesh Hansalia
ย 
PPT
Testing Software Solutions
gavhays
ย 
DOC
Manual Testing.
Dhanasekaran Nagarajan
ย 
PPTX
Gosecure Software Testing
Kristof Goossens
ย 
PPTX
Software testing - basics
Prasad Gali
ย 
PDF
Software testing quiz questions and answers
RajendraG
ย 
DOC
ISTQB Foundation level Sample Paper - Part 3
Parul Chotalia
ย 
DOC
Software engineering-quiz
Dr. C.V. Suresh Babu
ย 
PPTX
Software Requirement Specification
Vishal Singh
ย 
DOC
Software testing objective_types
sangeeswaran
ย 
Software Testing and Quality Assurance Assignment 2
Gurpreet singh
ย 
Seeking Assignments in QA/QC , Project Site , Piping Welding/Fabrication , In...
Shadab Haider Zaidi
ย 
Software Testing and Quality Assurance Assignment 3
Gurpreet singh
ย 
Software Testing Interview Q&A โ€“ part 1
Khoa Bui
ย 
Multiplateform testing
Gurpreet singh
ย 
Fundamentals of Testing 2
Hoang Nguyen
ย 
Software project management
Saumya Sahu
ย 
Some Commonly Asked Question For Software Testing
Kumari Warsha Goel
ย 
Fresher interview question for software testing (QA) manual + basic automation
Rakesh Hansalia
ย 
Testing Software Solutions
gavhays
ย 
Manual Testing.
Dhanasekaran Nagarajan
ย 
Gosecure Software Testing
Kristof Goossens
ย 
Software testing - basics
Prasad Gali
ย 
Software testing quiz questions and answers
RajendraG
ย 
ISTQB Foundation level Sample Paper - Part 3
Parul Chotalia
ย 
Software engineering-quiz
Dr. C.V. Suresh Babu
ย 
Software Requirement Specification
Vishal Singh
ย 
Software testing objective_types
sangeeswaran
ย 
Ad

Similar to Intro to Unit Testing with test Driven Development (20)

PPT
Automated Unit Testing and TDD
Greg Sohl
ย 
PDF
Hey You Got Your TDD in my SQL DB by Jeff McKenzie
QA or the Highway
ย 
PPTX
Test-Driven Development In Action
Jon Kruger
ย 
PDF
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Jason Tice
ย 
PPT
TDD (Test Driven Design)
nedirtv
ย 
PPTX
TDD Best Practices
Attila Bertรณk
ย 
PDF
Test Driven Development
Hicham El Hammouchi
ย 
PPT
Unit Testing, TDD and the Walking Skeleton
Seb Rose
ย 
PPTX
Test-Driven Development
Meilan Ou
ย 
PDF
Test Driven Development - Workshop
Anjana Somathilake
ย 
PDF
An Introduction to Test Driven Development
CodeOps Technologies LLP
ย 
PPTX
Test Driven Development
Rajesh Kumar
ย 
PPT
Test-Driven Development Introduction
Samsung Electronics
ย 
PPTX
Test Driven Development
Md. Enamul Haque Chowdhury
ย 
PDF
Real developers-dont-need-unit-tests
John Ferguson Smart Limited
ย 
PDF
Real developers-dont-need-unit-tests
Skills Matter
ย 
PDF
Real developers-dont-need-unit-tests
Skills Matter
ย 
PDF
Adopting TDD - by Don McGreal
Synerzip
ย 
PPTX
Unit Testing - Calgary .NET User Group - Nov 26 2014 - Depth Consulting
Dave White
ย 
PPTX
Test driven development in .Net - 2010 + Eclipse
UTC Fire & Security
ย 
Automated Unit Testing and TDD
Greg Sohl
ย 
Hey You Got Your TDD in my SQL DB by Jeff McKenzie
QA or the Highway
ย 
Test-Driven Development In Action
Jon Kruger
ย 
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Jason Tice
ย 
TDD (Test Driven Design)
nedirtv
ย 
TDD Best Practices
Attila Bertรณk
ย 
Test Driven Development
Hicham El Hammouchi
ย 
Unit Testing, TDD and the Walking Skeleton
Seb Rose
ย 
Test-Driven Development
Meilan Ou
ย 
Test Driven Development - Workshop
Anjana Somathilake
ย 
An Introduction to Test Driven Development
CodeOps Technologies LLP
ย 
Test Driven Development
Rajesh Kumar
ย 
Test-Driven Development Introduction
Samsung Electronics
ย 
Test Driven Development
Md. Enamul Haque Chowdhury
ย 
Real developers-dont-need-unit-tests
John Ferguson Smart Limited
ย 
Real developers-dont-need-unit-tests
Skills Matter
ย 
Real developers-dont-need-unit-tests
Skills Matter
ย 
Adopting TDD - by Don McGreal
Synerzip
ย 
Unit Testing - Calgary .NET User Group - Nov 26 2014 - Depth Consulting
Dave White
ย 
Test driven development in .Net - 2010 + Eclipse
UTC Fire & Security
ย 
Ad

Recently uploaded (20)

PPTX
declaration of Variables and constants.pptx
meemee7378
ย 
PDF
Automated Test Case Repair Using Language Models
Lionel Briand
ย 
PDF
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
ย 
DOCX
Zoho Creator Solution for EI by Elsner Technologies.docx
Elsner Technologies Pvt. Ltd.
ย 
PPTX
IObit Driver Booster Pro 12.4-12.5 license keys 2025-2026
chaudhryakashoo065
ย 
PPTX
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
2nd Sight Lab
ย 
PDF
capitulando la keynote de GrafanaCON 2025 - Madrid
Imma Valls Bernaus
ย 
PDF
Why Edge Computing Matters in Mobile Application Tech.pdf
IMG Global Infotech
ย 
PDF
What Is an Internal Quality Audit and Why It Matters for Your QMS
BizPortals365
ย 
PDF
Humans vs AI Call Agents - Qcall.ai's Special Report
Udit Goenka
ย 
PPTX
Iobit Driver Booster Pro 12 Crack Free Download
chaudhryakashoo065
ย 
PDF
AWS Consulting Services: Empowering Digital Transformation with Nlineaxis
Nlineaxis IT Solutions Pvt Ltd
ย 
PDF
OpenChain Webinar - AboutCode - Practical Compliance in One Stack โ€“ Licensing...
Shane Coughlan
ย 
PDF
Best Software Development at Best Prices
softechies7
ย 
PDF
Which Hiring Management Tools Offer the Best ROI?
HireME
ย 
PPTX
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
ย 
PDF
Automated Testing and Safety Analysis of Deep Neural Networks
Lionel Briand
ย 
PDF
Telemedicine App Development_ Key Factors to Consider for Your Healthcare Ven...
Mobilityinfotech
ย 
PDF
The Next-Gen HMIS Software AI, Blockchain & Cloud for Housing.pdf
Prudence B2B
ย 
DOCX
Best AI-Powered Wearable Tech for Remote Health Monitoring in 2025
SEOLIFT - SEO Company London
ย 
declaration of Variables and constants.pptx
meemee7378
ย 
Automated Test Case Repair Using Language Models
Lionel Briand
ย 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
ย 
Zoho Creator Solution for EI by Elsner Technologies.docx
Elsner Technologies Pvt. Ltd.
ย 
IObit Driver Booster Pro 12.4-12.5 license keys 2025-2026
chaudhryakashoo065
ย 
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
2nd Sight Lab
ย 
capitulando la keynote de GrafanaCON 2025 - Madrid
Imma Valls Bernaus
ย 
Why Edge Computing Matters in Mobile Application Tech.pdf
IMG Global Infotech
ย 
What Is an Internal Quality Audit and Why It Matters for Your QMS
BizPortals365
ย 
Humans vs AI Call Agents - Qcall.ai's Special Report
Udit Goenka
ย 
Iobit Driver Booster Pro 12 Crack Free Download
chaudhryakashoo065
ย 
AWS Consulting Services: Empowering Digital Transformation with Nlineaxis
Nlineaxis IT Solutions Pvt Ltd
ย 
OpenChain Webinar - AboutCode - Practical Compliance in One Stack โ€“ Licensing...
Shane Coughlan
ย 
Best Software Development at Best Prices
softechies7
ย 
Which Hiring Management Tools Offer the Best ROI?
HireME
ย 
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
ย 
Automated Testing and Safety Analysis of Deep Neural Networks
Lionel Briand
ย 
Telemedicine App Development_ Key Factors to Consider for Your Healthcare Ven...
Mobilityinfotech
ย 
The Next-Gen HMIS Software AI, Blockchain & Cloud for Housing.pdf
Prudence B2B
ย 
Best AI-Powered Wearable Tech for Remote Health Monitoring in 2025
SEOLIFT - SEO Company London
ย 

Intro to Unit Testing with test Driven Development

  • 1. Intro to Test Driven Development (TDD) Consulting/Training
  • 2. Consulting/Training About Me ๏‚— Microsoft Client Development MVP ๏‚— ASPInsider ๏‚— Twitter: @joelcochran ๏‚— Email: [email protected] ๏‚— Blog: joelcochran.com ๏‚— Lead Developer, WintellectNOW
  • 3. Consulting/Training About Wintellect Founded by top experts on Microsoft โ€“ Jeffrey Richter, Jeff Prosise, and John Robbins โ€“ we pull out all the stops to help our customers achieve their goals through advanced software-based consulting and training solutions. consulting Wintellect helps you build better software, faster, tackling the tough projects and solving the software and technology questions that help you transform your business. ๏‚— Architecture, Analysis and Design ๏‚— Full lifecycle software development ๏‚— Debugging and Performance tuning ๏‚— Database design and development training Wintellect's courses are written and taught by some of the biggest and most respected names in the Microsoft programming industry. ๏‚— Learn from the best. Access the same training Microsoftโ€™s developers enjoy ๏‚— Real world knowledge and solutions on both current and cutting edge technologies ๏‚— Flexibility in training options โ€“ onsite, virtual, on demand who we are
  • 4. Wintellectโ€™s On-Demand Video Training Solution Try it free Code: <INSERT CODE HERE> WintellectNOW.com COCHRAN-13 Authors Enjoy: ๏‚— Royalty Income ๏‚— Personal Branding ๏‚— Cross-Sell Opps ๏‚— Free library access Subscribers Enjoy: ๏‚— Expert Instructors ๏‚— Quality Content ๏‚— Practical Application ๏‚— All Devices Consulting/Training Individuals | Businesses | Enterprise Organizations
  • 5. Interview with a Method Consulting/Training
  • 6. The Multiply Method Signature Int32 Multiply(Int32[] values) Consulting/Training
  • 7. Consulting/Training Question #1 What parameter(s) do you take? An Array of Int32
  • 8. Consulting/Training Question #2 What value type do you return? Int32
  • 9. Consulting/Training Question #3 What happens when I pass you: [3, 4]? I donโ€™t know
  • 10. Consulting/Training Question #4 What happens when I pass you: [7]? I donโ€™t know
  • 11. Consulting/Training Question #5 What happens when I pass you: [-5, 12, 10, -3]? I donโ€™t know
  • 12. Consulting/Training Question #6 What happens when I pass you: null? I donโ€™t know
  • 13. Consulting/Training Question #7 What happens when I pass you: [23, Int32.MaxValue]? I donโ€™t know
  • 14. Consulting/Training Question #8 You donโ€™t seem to know muchโ€ฆ If you donโ€™t know the answer to these questions, who does? The Unit Tests
  • 15. Consulting/Training What is a Unit Test? ๏‚— Code that tests code ๏‚— Small discrete chunks (units) ๏‚— One test, one condition ๏‚— Based on assumptions ๏‚— Should be automated and repeatable
  • 16. What a Unit Test is Not Consulting/Training ๏‚— An end-to-end test ๏‚— Connected to live data ๏‚— Performing external functions (like sending an Email) ๏‚— User tests
  • 17. Consulting/Training Why write Unit Tests? ๏‚— Test code to ensure proper functionality given certain assumptions ๏‚— Exercise code without running the app ๏‚— Write once, run a million times ๏‚— Guards against unintended consequences ๏‚— Tests define success
  • 18. Consulting/Training What is TDD? ๏‚— Unit Tests are written before the code ๏‚— Helps shape the code to the task at hand ๏‚— Provides focus (YAGNI) ๏‚— The test defines success ๏‚— Run all tests every time
  • 19. Consulting/Training TDD Pattern RED write a failing test GREEN write enough code to pass REFACTOR engineer the code
  • 20. Anatomy of a Unit Test Consulting/Training Arrange โ€ข Assumptions โ€ข Expectations Act โ€ข Execute โ€ข Results Assert โ€ข Compare โ€ข Report
  • 21. Consulting/Training TDD Kata ๏‚— Daily exercise โ€“ 30 minutes or less ๏‚— Roy Osherove, author of โ€œThe Art of Unit Testingโ€, Manning Publications ๏‚— http://osherove.com/tdd-kata-1/ ๏‚— Letโ€™s code!
  • 22. The String Calculator Kata Consulting/Training

Editor's Notes

  • #14: Actual result == Int32.MaxValue โ€“ (multiplier โ€“ 1) == 2147483625 Int32.MaxValue = 2147483647 Every time you multiply (except for * 1) you overflow the Integer value Subtract 1 for the value of 0 every time this happens