SlideShare a Scribd company logo
Test-Driven Development by John Blanco
The process of designing software by writing a validating client before the code.  What is Test-Driven Development (TDD)? Maintaining an evolving set of unit tests that continuously validate the correctness (or not) of your code.  What is Automated Unit Testing?
Automated Unit Testing != Test-Driven Development TDD is a way of thinking about your code, but it doesn’t require unit testing.  That being said, you should write them if you can.  Agile processes adapt to change.  Unit tests help to manage change in our code.  Unit Testing is a key component of the Agile Methodology
Dispelling Unit Testing Myths
No.   Writing unit tests is an investment towards time savings over the lifetime of the project. Myth #1:  Won’t writing unit tests double by development time? We won’t need to constantly validate our code each time we make changes. Finding the bugs early means far less time fixing them later. If our unit tests are good, we won’t need to spend hours or days tracking down bugs in the most fundamental layers of our code.
No.   Unit tests are not parallel to your code like documentation.  You will be  driving  your code with them. Myth #2:  Won’t all my unit tests just get out of date? TDD is a programming paradigm. Unit tests are not an artifact of your code.  They represent how you write it! However, if you don’t appreciate unit testing, they likely will not be worth the time to create.
No.   The client is paying for clean, correct code.  Unit testing is the means to that end. Myth #3:  Won’t the client refuse to pay for it? Do they pay us to test our code? Do they pay us to use design patterns? Do they pay us to use UML?
xUnit is the framework for automating our unit tests. Implementations exist for C++, C#, Java, PHP, Ruby, Python, Perl, Prolog, LISP, … and Flex!  Created by Erich Gamma, member of the GoF and co-author of Eclipse JDT. Introducing xUnit!
FlexUnit is the Flex implementation of xUnit. FlexUnit Tests you will be performing on your code: assertEquals() assertTrue() assertNotUndefined() assertStrictlyEquals() …
Don’t worry.  Chances are, you’re already writing unit tests!  Whoa! Whoa! Hold On -- This Seems Excessive!
<mx:Application creationComplete=“onCreationComplete()”> <mx:Script> private function onCreationComplete():void { // DEVELOPMENT ONLY - REMOVE LATER var htmlMaker:MyHTMLMaker = new MyHTMLMaker(); htmlMaker.startTag(“b”); htmlMaker.addContent(“My bold text!!!”); htmlMaker.endTag(); trace(“RESULT: ” + htmlMaker.toString()); } </mx:Script> . . . </mx:Application> Ever Write Code Like This…And Then Delete It Afterwards?
Fool!   The problem is that you’re not anticipating CHANGE.  When that happens, you will need to modify and test your code all over again. What if we kept that test? Yes!  And then once I verify it’s working, I remove it. So?
There are two ways we can organize our unit tests: Inside the project Outside the project My personal preference is outside of the project.  Here’s why: Keeps our code and unit tests physically separate. Avoids the double-build conundrum. Allows us to close the unit test project when desirable. Allows us to run tests against projects in multiple locations. Setting Up Your Project For TDD  http://raptureinvenice.blogspot.com/2008/04/better-way-to-set-up-flexunit.html Reference:
Create a Flex or AIR project. (e.g., twitterme) Create a Flex or AIR unit testing project. (e.g., twitterme-tests) Add twitterme/src to the source path of twitterme-tests. Add a boilerplate TestRunner application to twitterme-tests. Add flexunit.swc to twitterme-tests/libs. Setting Up Your Project For TDD  http://code.google.com/p/as3flexunitlib/ References: http://raptureinvenice.blogspot.com/2008/04/better-way-to-set-up-flexunit.html
Working Session
Wait!  We Need a Change!
What Have We Accomplished?
Gain #1:  We have a clean, stable piece of code We know the client code will be easy to use, because we  drove  the code based on the client itself! We have tested the code as thoroughly as we can using unit tests. We have kept the unit tests as an artifact of the coding effort so that we can continually re-run the tests as needed. Code usage is already documented for our customers!
Gain #2:  We will feel confident making changes to the code If we make a change to this code, we can re-run the unit tests to verify if the code is still functionally correct - instantly! We don’t have to fear the major changes that will likely be made later.  Because what is the one constant in software development? CHANGE.
dpuint offers some enhancements over FlexUnit that you might find valuable.  The key differences are: Better asynchronous support Sequencing tests Cairngorn tests Highly recommended if you want to test UI.  A Newer Flex Testing Framework: dpuint
Questions?

More Related Content

PDF
PHPUnit with Magento
PDF
Code Review
PDF
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
PPT
Code Review
PPTX
Importance of the quality of code
PDF
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
PDF
Chapter17 of clean code
ODP
Tdd in php a brief example
PHPUnit with Magento
Code Review
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
Code Review
Importance of the quality of code
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
Chapter17 of clean code
Tdd in php a brief example

What's hot (15)

PPTX
Code review process with JetBrains UpSource
PDF
Civilized Git Process
PDF
TDD and Simple Design Workshop - Session 1 - March 2019
PPTX
Test Driven Development
PPTX
Behaviour Driven Development with SpecFlow
PPT
Code Review
PPTX
Bdd and spec flow
PPTX
TDD Basics with Angular.js and Jasmine
PPTX
“One man” development process model
PDF
Test driven development vs Behavior driven development
PPSX
SCM Process and smartBuild
PPTX
Dot all 2019 | Testing with Craft | Giel Tettelar
PPTX
Test Driven Development (TDD) Preso 360|Flex 2010
ODP
TDD - Test Driven Development
Code review process with JetBrains UpSource
Civilized Git Process
TDD and Simple Design Workshop - Session 1 - March 2019
Test Driven Development
Behaviour Driven Development with SpecFlow
Code Review
Bdd and spec flow
TDD Basics with Angular.js and Jasmine
“One man” development process model
Test driven development vs Behavior driven development
SCM Process and smartBuild
Dot all 2019 | Testing with Craft | Giel Tettelar
Test Driven Development (TDD) Preso 360|Flex 2010
TDD - Test Driven Development
Ad

Viewers also liked (20)

PPT
Ckv[1]
PPT
Life In The Tundralanzillotta
DOC
物件導向程式設計課程講義(98 ges hi版)
PDF
#Mrec September 24 2013 Keynote
PDF
URA Task Force - PDNA
PDF
Ringling college
PDF
Axfood Q12009 En
PDF
Portfolio
PPT
Ckv[1]
PPT
Itb Chap 16
PDF
Oslo Enterprise MeetUp May 12th 2010 - Jan Høydahl
PDF
2009-10-21 Presentation at media and analyst meeting
PDF
Search Deltawateren oogst flip-overs
PDF
Frokostseminar mai 2010 solr open source cominvent as
PDF
Axfood Annual general meeting 2014
PPT
The Great Tundra Project Tan
PPT
v2 3rd (11-13 June 2015) KNH and UON Conference-Research as a Driver for Scie...
PPT
My Arctic Tundra Project!Custer
PPTX
Determinants of host susceptibility in aggressive periodontitis+Conference+Pr...
Ckv[1]
Life In The Tundralanzillotta
物件導向程式設計課程講義(98 ges hi版)
#Mrec September 24 2013 Keynote
URA Task Force - PDNA
Ringling college
Axfood Q12009 En
Portfolio
Ckv[1]
Itb Chap 16
Oslo Enterprise MeetUp May 12th 2010 - Jan Høydahl
2009-10-21 Presentation at media and analyst meeting
Search Deltawateren oogst flip-overs
Frokostseminar mai 2010 solr open source cominvent as
Axfood Annual general meeting 2014
The Great Tundra Project Tan
v2 3rd (11-13 June 2015) KNH and UON Conference-Research as a Driver for Scie...
My Arctic Tundra Project!Custer
Determinants of host susceptibility in aggressive periodontitis+Conference+Pr...
Ad

Similar to Test Driven Development (20)

PPTX
Test Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose preso
PPT
Why test with flex unit
PPT
Test Driven Development using QUnit
PPTX
An Introduction to Unit Testing
PPTX
Test-Driven Development In Action
PPTX
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
PPTX
VT.NET 20160411: An Intro to Test Driven Development (TDD)
PDF
Unit testing (eng)
ODP
xUnit and TDD: Why and How in Enterprise Software, August 2012
PDF
An Introduction to Test Driven Development
PPTX
Understanding TDD - theory, practice, techniques and tips.
PPTX
Unit Testing and TDD 2017
PPT
Unit testing
KEY
Driving application development through behavior driven development
PPTX
The Test way
PDF
ABAPCodeRetreat Frankfurt 2016 - TDD with ABAP
PDF
ABAP Code Retreat Frankfurt 2016: TDD - Test Driven Development
PDF
Test Driven iOS Development (TDD)
PPTX
Test Driven Development on Android (Kotlin Kenya)
PDF
Test driven development
Test Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose preso
Why test with flex unit
Test Driven Development using QUnit
An Introduction to Unit Testing
Test-Driven Development In Action
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
VT.NET 20160411: An Intro to Test Driven Development (TDD)
Unit testing (eng)
xUnit and TDD: Why and How in Enterprise Software, August 2012
An Introduction to Test Driven Development
Understanding TDD - theory, practice, techniques and tips.
Unit Testing and TDD 2017
Unit testing
Driving application development through behavior driven development
The Test way
ABAPCodeRetreat Frankfurt 2016 - TDD with ABAP
ABAP Code Retreat Frankfurt 2016: TDD - Test Driven Development
Test Driven iOS Development (TDD)
Test Driven Development on Android (Kotlin Kenya)
Test driven development

Recently uploaded (20)

PDF
Modernizing your data center with Dell and AMD
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Machine learning based COVID-19 study performance prediction
PPTX
A Presentation on Artificial Intelligence
PDF
Electronic commerce courselecture one. Pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Empathic Computing: Creating Shared Understanding
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Cloud computing and distributed systems.
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPT
Teaching material agriculture food technology
PDF
KodekX | Application Modernization Development
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Review of recent advances in non-invasive hemoglobin estimation
Modernizing your data center with Dell and AMD
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
“AI and Expert System Decision Support & Business Intelligence Systems”
Machine learning based COVID-19 study performance prediction
A Presentation on Artificial Intelligence
Electronic commerce courselecture one. Pdf
cuic standard and advanced reporting.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Empathic Computing: Creating Shared Understanding
20250228 LYD VKU AI Blended-Learning.pptx
Unlocking AI with Model Context Protocol (MCP)
Cloud computing and distributed systems.
Understanding_Digital_Forensics_Presentation.pptx
Teaching material agriculture food technology
KodekX | Application Modernization Development
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Review of recent advances in non-invasive hemoglobin estimation

Test Driven Development

  • 2. The process of designing software by writing a validating client before the code. What is Test-Driven Development (TDD)? Maintaining an evolving set of unit tests that continuously validate the correctness (or not) of your code. What is Automated Unit Testing?
  • 3. Automated Unit Testing != Test-Driven Development TDD is a way of thinking about your code, but it doesn’t require unit testing. That being said, you should write them if you can. Agile processes adapt to change. Unit tests help to manage change in our code. Unit Testing is a key component of the Agile Methodology
  • 5. No. Writing unit tests is an investment towards time savings over the lifetime of the project. Myth #1: Won’t writing unit tests double by development time? We won’t need to constantly validate our code each time we make changes. Finding the bugs early means far less time fixing them later. If our unit tests are good, we won’t need to spend hours or days tracking down bugs in the most fundamental layers of our code.
  • 6. No. Unit tests are not parallel to your code like documentation. You will be driving your code with them. Myth #2: Won’t all my unit tests just get out of date? TDD is a programming paradigm. Unit tests are not an artifact of your code. They represent how you write it! However, if you don’t appreciate unit testing, they likely will not be worth the time to create.
  • 7. No. The client is paying for clean, correct code. Unit testing is the means to that end. Myth #3: Won’t the client refuse to pay for it? Do they pay us to test our code? Do they pay us to use design patterns? Do they pay us to use UML?
  • 8. xUnit is the framework for automating our unit tests. Implementations exist for C++, C#, Java, PHP, Ruby, Python, Perl, Prolog, LISP, … and Flex! Created by Erich Gamma, member of the GoF and co-author of Eclipse JDT. Introducing xUnit!
  • 9. FlexUnit is the Flex implementation of xUnit. FlexUnit Tests you will be performing on your code: assertEquals() assertTrue() assertNotUndefined() assertStrictlyEquals() …
  • 10. Don’t worry. Chances are, you’re already writing unit tests! Whoa! Whoa! Hold On -- This Seems Excessive!
  • 11. <mx:Application creationComplete=“onCreationComplete()”> <mx:Script> private function onCreationComplete():void { // DEVELOPMENT ONLY - REMOVE LATER var htmlMaker:MyHTMLMaker = new MyHTMLMaker(); htmlMaker.startTag(“b”); htmlMaker.addContent(“My bold text!!!”); htmlMaker.endTag(); trace(“RESULT: ” + htmlMaker.toString()); } </mx:Script> . . . </mx:Application> Ever Write Code Like This…And Then Delete It Afterwards?
  • 12. Fool! The problem is that you’re not anticipating CHANGE. When that happens, you will need to modify and test your code all over again. What if we kept that test? Yes! And then once I verify it’s working, I remove it. So?
  • 13. There are two ways we can organize our unit tests: Inside the project Outside the project My personal preference is outside of the project. Here’s why: Keeps our code and unit tests physically separate. Avoids the double-build conundrum. Allows us to close the unit test project when desirable. Allows us to run tests against projects in multiple locations. Setting Up Your Project For TDD http://raptureinvenice.blogspot.com/2008/04/better-way-to-set-up-flexunit.html Reference:
  • 14. Create a Flex or AIR project. (e.g., twitterme) Create a Flex or AIR unit testing project. (e.g., twitterme-tests) Add twitterme/src to the source path of twitterme-tests. Add a boilerplate TestRunner application to twitterme-tests. Add flexunit.swc to twitterme-tests/libs. Setting Up Your Project For TDD http://code.google.com/p/as3flexunitlib/ References: http://raptureinvenice.blogspot.com/2008/04/better-way-to-set-up-flexunit.html
  • 16. Wait! We Need a Change!
  • 17. What Have We Accomplished?
  • 18. Gain #1: We have a clean, stable piece of code We know the client code will be easy to use, because we drove the code based on the client itself! We have tested the code as thoroughly as we can using unit tests. We have kept the unit tests as an artifact of the coding effort so that we can continually re-run the tests as needed. Code usage is already documented for our customers!
  • 19. Gain #2: We will feel confident making changes to the code If we make a change to this code, we can re-run the unit tests to verify if the code is still functionally correct - instantly! We don’t have to fear the major changes that will likely be made later. Because what is the one constant in software development? CHANGE.
  • 20. dpuint offers some enhancements over FlexUnit that you might find valuable. The key differences are: Better asynchronous support Sequencing tests Cairngorn tests Highly recommended if you want to test UI. A Newer Flex Testing Framework: dpuint