SlideShare ist ein Scribd-Unternehmen logo
1 von 10
November 16, 2010 NWO-PUG 1
Intro to Test Driven DevelopmentIntro to Test Driven Development
Chris TankersleyChris Tankersley
Joind.in Link: http://joind.in/2347
E-mail: chris@ctankersley.com
Twitter: @dragonmantank
November 16, 2010 NWO-PUG 2
Who Are You and Why Are You InWho Are You and Why Are You In
My House?My House?
Chris TankersleyChris Tankersley
Been doing PHP for almost 8 years nowBeen doing PHP for almost 8 years now
Lots of projects no one uses released under theLots of projects no one uses released under the
BSD licenseBSD license
Contributer to the Habari ProjectContributer to the Habari Project
November 16, 2010 NWO-PUG 3
What is Test Driven Development?What is Test Driven Development?
„„Test-driven development (TDD) is a softwareTest-driven development (TDD) is a software
development process that relies on the repetitiondevelopment process that relies on the repetition
of a very short development cycle: first theof a very short development cycle: first the
developer writes a failing automated test case thatdeveloper writes a failing automated test case that
defines a desired improvement or new function,defines a desired improvement or new function,
then produces code to pass that test and finallythen produces code to pass that test and finally
refactors the new code to acceptable standards.”refactors the new code to acceptable standards.”
http://en.wikipedia.org/wiki/Test-driven_development
November 16, 2010 NWO-PUG 4
Why Do TDD?Why Do TDD?
●
Considered a Best Practice amongst almost allConsidered a Best Practice amongst almost all
languageslanguages
●
Provides confidence in the codeProvides confidence in the code
●
Provides confidence in the requirementsProvides confidence in the requirements
●
Proves remediationProves remediation
November 16, 2010 NWO-PUG 5
TDD is EasyTDD is Easy
1)1)Write a TestWrite a Test
2)2)Watch it FailWatch it Fail
3)3)Write CodeWrite Code
4)4)TestTest
5)5)Repeat 3 and 4 until PassingRepeat 3 and 4 until Passing
6)6)Repeat AllRepeat All
November 16, 2010 NWO-PUG 6
Our Sample ApplicationOur Sample Application
●
Create an application to test basic math skillsCreate an application to test basic math skills
●
We need a Calculator to add numbersWe need a Calculator to add numbers
●
Needs to handle bad inputNeeds to handle bad input
●
We need a Tutor class to test answersWe need a Tutor class to test answers
November 16, 2010 NWO-PUG 7
[CODE][CODE]
November 16, 2010 NWO-PUG 8
LinksLinks
●
PhpUnitPhpUnit
●
http://www.phpunit.de/http://www.phpunit.de/
November 16, 2010 NWO-PUG 9
Thanks toThanks to
●
Jeremy KendallJeremy Kendall
●
http://www.jeremykendall.net/http://www.jeremykendall.net/
November 16, 2010 NWO-PUG 9
Thanks toThanks to
●
Jeremy KendallJeremy Kendall
●
http://www.jeremykendall.net/http://www.jeremykendall.net/

Weitere ähnliche Inhalte

Mehr von Chris Tankersley

Mehr von Chris Tankersley (20)

Bend time to your will with git
Bend time to your will with gitBend time to your will with git
Bend time to your will with git
 
Using PHP Functions! (Not those functions, Google Cloud Functions)
Using PHP Functions! (Not those functions, Google Cloud Functions)Using PHP Functions! (Not those functions, Google Cloud Functions)
Using PHP Functions! (Not those functions, Google Cloud Functions)
 
Dead Simple APIs with OpenAPI
Dead Simple APIs with OpenAPIDead Simple APIs with OpenAPI
Dead Simple APIs with OpenAPI
 
Killer Docker Workflows for Development
Killer Docker Workflows for DevelopmentKiller Docker Workflows for Development
Killer Docker Workflows for Development
 
You Got Async in my PHP!
You Got Async in my PHP!You Got Async in my PHP!
You Got Async in my PHP!
 
Docker for Developers - PHP Detroit 2018
Docker for Developers - PHP Detroit 2018Docker for Developers - PHP Detroit 2018
Docker for Developers - PHP Detroit 2018
 
Docker for Developers
Docker for DevelopersDocker for Developers
Docker for Developers
 
They are Watching You
They are Watching YouThey are Watching You
They are Watching You
 
BASHing at the CLI - Midwest PHP 2018
BASHing at the CLI - Midwest PHP 2018BASHing at the CLI - Midwest PHP 2018
BASHing at the CLI - Midwest PHP 2018
 
You Were Lied To About Optimization
You Were Lied To About OptimizationYou Were Lied To About Optimization
You Were Lied To About Optimization
 
Docker for PHP Developers - php[world] 2017
Docker for PHP Developers - php[world] 2017Docker for PHP Developers - php[world] 2017
Docker for PHP Developers - php[world] 2017
 
Docker for PHP Developers - Madison PHP 2017
Docker for PHP Developers - Madison PHP 2017Docker for PHP Developers - Madison PHP 2017
Docker for PHP Developers - Madison PHP 2017
 
Docker for Developers - php[tek] 2017
Docker for Developers - php[tek] 2017Docker for Developers - php[tek] 2017
Docker for Developers - php[tek] 2017
 
Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017
 
OOP Is More Then Cars and Dogs - Midwest PHP 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017OOP Is More Then Cars and Dogs - Midwest PHP 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017
 
From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017
 
Docker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHPDocker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHP
 
How We Got Here: A Brief History of Open Source
How We Got Here: A Brief History of Open SourceHow We Got Here: A Brief History of Open Source
How We Got Here: A Brief History of Open Source
 
Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016
 
From Docker to Production - ZendCon 2016
From Docker to Production - ZendCon 2016From Docker to Production - ZendCon 2016
From Docker to Production - ZendCon 2016
 

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

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
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
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...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 

Intro To Test Driven Development

  • 1. November 16, 2010 NWO-PUG 1 Intro to Test Driven DevelopmentIntro to Test Driven Development Chris TankersleyChris Tankersley Joind.in Link: http://joind.in/2347 E-mail: chris@ctankersley.com Twitter: @dragonmantank
  • 2. November 16, 2010 NWO-PUG 2 Who Are You and Why Are You InWho Are You and Why Are You In My House?My House? Chris TankersleyChris Tankersley Been doing PHP for almost 8 years nowBeen doing PHP for almost 8 years now Lots of projects no one uses released under theLots of projects no one uses released under the BSD licenseBSD license Contributer to the Habari ProjectContributer to the Habari Project
  • 3. November 16, 2010 NWO-PUG 3 What is Test Driven Development?What is Test Driven Development? „„Test-driven development (TDD) is a softwareTest-driven development (TDD) is a software development process that relies on the repetitiondevelopment process that relies on the repetition of a very short development cycle: first theof a very short development cycle: first the developer writes a failing automated test case thatdeveloper writes a failing automated test case that defines a desired improvement or new function,defines a desired improvement or new function, then produces code to pass that test and finallythen produces code to pass that test and finally refactors the new code to acceptable standards.”refactors the new code to acceptable standards.” http://en.wikipedia.org/wiki/Test-driven_development
  • 4. November 16, 2010 NWO-PUG 4 Why Do TDD?Why Do TDD? ● Considered a Best Practice amongst almost allConsidered a Best Practice amongst almost all languageslanguages ● Provides confidence in the codeProvides confidence in the code ● Provides confidence in the requirementsProvides confidence in the requirements ● Proves remediationProves remediation
  • 5. November 16, 2010 NWO-PUG 5 TDD is EasyTDD is Easy 1)1)Write a TestWrite a Test 2)2)Watch it FailWatch it Fail 3)3)Write CodeWrite Code 4)4)TestTest 5)5)Repeat 3 and 4 until PassingRepeat 3 and 4 until Passing 6)6)Repeat AllRepeat All
  • 6. November 16, 2010 NWO-PUG 6 Our Sample ApplicationOur Sample Application ● Create an application to test basic math skillsCreate an application to test basic math skills ● We need a Calculator to add numbersWe need a Calculator to add numbers ● Needs to handle bad inputNeeds to handle bad input ● We need a Tutor class to test answersWe need a Tutor class to test answers
  • 7. November 16, 2010 NWO-PUG 7 [CODE][CODE]
  • 8. November 16, 2010 NWO-PUG 8 LinksLinks ● PhpUnitPhpUnit ● http://www.phpunit.de/http://www.phpunit.de/
  • 9. November 16, 2010 NWO-PUG 9 Thanks toThanks to ● Jeremy KendallJeremy Kendall ● http://www.jeremykendall.net/http://www.jeremykendall.net/
  • 10. November 16, 2010 NWO-PUG 9 Thanks toThanks to ● Jeremy KendallJeremy Kendall ● http://www.jeremykendall.net/http://www.jeremykendall.net/