SlideShare a Scribd company logo
1 of 36
Download to read offline
EFFECTIVE AND PRAGMATIC TEST DRIVEN DEVELOPMENT
ANDREW RENDELL, PRINCIPAL CONSULTANT
INTRODUCTION


 IS TDD REALLY UBIQUITOUS?

 EVALUATION OF THE APPLICATION OF TDD ON A REAL WORLD
 PROJECT

 IMPEDIMENTS AND THEIR RESOLUTION

 TANGIBLE BENEFITS
PROJECT CONTEXT
 T-MOBILE

 MOBILE INTERNET PORTAL

 WEBNWALK3

 PERSONALISED EXPERIENCE



 GO LIVE DATE INVARIANT
DEVELOPMENT DYNAMIC

 STRONG CUSTOMER FOCUS
   COMMITMENT TO ERROR FREE USER EXPERIENCE
   CARRIER GRADE SOFTWARE QUALITY

 PRESSURE TO DELIVER
   MARKETING DRIVEN
   HIGHLY COMPETITIVE

 CONFLICTING DRIVERS
   RISK ADVERSE          CONSERVATIVE
   HIGHLY COMPETITIVE          RAPID ADAPTABILITY
“VALTECH BELIEVES
THAT AGILE, AND IN
PARTICULAR TEST
DRIVEN DEVELOPMENT
CAN HELP THESE
COMPANIES DELIVER
QUICKLY AND SAFELY.”
MAKING A PROJECT TEST DRIVEN
MAKING A PROJECT TEST DRIVEN

 WHERE WE STARTED

 HOW THE INTENT WAS COMMUNICATED

 STRUCTURING THE APPLICATION TO STRUCTURE
 DEVELOPMENT ACTIVITIES

 HUMAN INTERACTION WITH DEVELOPERS
MAKING A PROJECT TEST DRIVEN




                               DEVELOPERS EXPERIENCE

                               ONE OR TWO WITH
                               TDD EXPERIENCE //
                               MOST HAD GOOD
                               UNDERSTANDING OF
                               TDD THEORY //
                               ALMOST ALL HAD
                               USED JUNIT //
                               MOST HIGH CALIBRE
                               JAVA DEVELOPERS
MAKING A PROJECT TEST DRIVEN




                               MANAGEMENT EXPERIENCE

                               EXPERTS IN MOBILE
                               TELCO // GOOD
                               UNDERSTANDING OF
                               AGILE THEORY //
                               READY TO EMBRACE
                               NEW PRACTICES //
                               LONG HISTORY OF
                               WATERFALL,
                               DOCUMENT CENTRIC
MAKING A PROJECT TEST DRIVEN




                               AT INCEPTION

                               NO INTENT TO USE
                               TDD
                               END OF INCEPTION

                               SOME JUNIT TESTS //
                               DECIDE TO USE TDD
                               // MEASURE
                               EXISTING COVERAGE
                               // AUDIT EXISTING
                               USE OF TESTS
COMMUNICATING THE INTENT


 MOST IMPORTANT

 INTERACTIVE SESSIONS

 TEAM WAS INEXPERIENED

 ACCEPTED INEVITABILITY OF MAKING MISTAKES
TDD THROUGH APPLICATION STRUCTURE

 WEBNWALK IS A STANDARD MVC APPLICATION

 INDENTIFIED INTEGRATION PAIN POINT
  PRESENTATION LAYER / SERVER SIDE
  DIFFERENT TEAMS, SKILLS, COMPLEXITY, TIMESCALES


 RIGOROUS DEFINITION OF INTERFACE THROUGH CONTRACT

 CONTRACT BECOMES STARTING POINT OF DEVELOPMENT
EmailWidgetService     XXXEmailContract
                     +customerNotAuthenticatedWithPartner() : EmailWidgetModel
                     +oneReadOneUnreadEmail() : EmailWidgetModel
                     +noUneadEmailFiveReadEmail() : EmailWidgetModel
                     +noEmai() : EmailWidgetModel
                     +manyEmails() : EmailWidgetModel
                     +errorGettingEmails() : EmailWidgetModel




                     XXXEmailAcceptanceTest                              JUnit4 Test




                     XXXEmailWidgetService
TOP DOWN DEVELOPMENT
                               Tests
         EmailAcceptanceTest           EmailWidgetService




                               Tests
  EmailWidgetServiceImplTest           EmailWidgetServiceImpl

                                              Uses


                                       CustomerDAO




                               Tests
       CustomerDAOImplTest             CustomerDAOImpl
RESPECT // EMPOWERMENT // AVOID DOGMA // IN RETROSPECT, TOO
MUCH FLEXIBILITY ALLOWED, ESPECIALLY FOR LESS EXPERIENCED
DEVELOPERS




RESPECTING THE
DEVELOPERS FREEDOM
IMPEDIMENTS AND PITFALLS
DISILLUSINMENT // DOGMATIC APPROACH
DISILLUSIONMENT

 PATTERN SEEN ON SEVERAL PROJECTS

 COMMON AMONGST NEW PRACTITIONERS

 EVERYONE WENT THROUGH SOME OF THE STAGES
DISILLUSIONMENT

 TOO FOCUSED ON TDD AS AN OBJECTIVE RATHER THAN AS A
 VEHICLE

 VELOCITY BEING MEASURED FOR FIRST TIME

 HIGHLIGHTS SLIPPAGE

 TDD BLAMED
DOGMATIC APPLICATION

 ALL NEWCOMERS TO TDD AFFECTED,
 NOT JUST THOSE LESS EXPERIENCED IN TOOLSET

 TOO FOCUSED ON THE APPLICATION OF THE TECHNIQUE

 FAILURE TO PERCEIVE THE DIFFERENT IN VALUE OF DIFFERENT
 TESTS
DOGMATIC APPLICATION

 BEST DEVELOPERS FOCUSED ON WHY TESTS WERE BEING
 WRITTEN

 WROTE AND REWROTE CLASSES TO EXPEDITE TESTING

 VIEWED INCORRECTLY AS „FAILURE‟ BY NEW DEVELOPERS
TRIVIAL EXAMPLE
     AverageDurationAnalyserImpl.java
     /**
      * Obtains the current time.
      * protected so can be overridden in unit test
      */
     protected long getCurrentTime() {
     return System.currentTimeMillis();
     }

     AverageDurationAnalyserImplTest.java
     private static long RIGHT_NOW = 1000;

     @Before
     public void onSetup() {
     analyser = new AverageDurationAnalyserImpl(){
     @Override
      protected long getCurrentTime() {return RIGHT_NOW ;}};
     }
MEASURABLE BENEFITS
MEASURABLE BENEFITS

IMPROVED CODE
STRUCTURE //
LESS REDUNDANT
EFFORT//
VIRTUOUS CIRCLE
IMPROVED COHESION

 STRONG COHESION IS ONE OF THE MOST IMPORTANT
 ATTRIBUTES OF WELL STRUCTURED CODE

 TDD NATURALLY ENCOURAGES COHESION

 TOP DOWN APPROACH MEANS RESPONSIBILITY IS WELL
 UNDERSTOOD BEFORE CODE IS BEGUN

 WRITING A TEST WHICH HAS MORE THAN ONE SET OF GOALS
 IS AN OBVIOUS BAD SMELL AND INDICATES TIME TO
 DELEGATE
LOW COHESION
Logic for implementation of transformation                                           Http Client
implemented piecemeal for several classes




AuctionWidgetModel
           Tests                    WidgetService               Worker               HmlService


          Tests                                                       Tests

AuctionWidgetModelTest
           Tests                                 WorkerTest   Tests
+testSelling()                                   +testCombineWatchingAndBuyingTotals()


                                                                                          Tests

             Logic for testing data transformation                            HmlServiceTest
                                                                                          Tests
             implemented in several different classes                         +testWatchingData()
HIGH COHESION

                       All data transformation logic encapsulated in
                       Xml Adaptor. All tests and test data in XmlAdaptorTest.



WidgetService                Worker                    HttpClient




      AuctionWidgetModel                             XmlAdaptor
                 Tests




                                                   XmlAdaptorTest
A COMMON PROBLEM // TDD ENCOURAGES FOCUS ON WHAT IS
REQUIRED // DISCOURAGES SPECULATION SEEMS PARTICULARLY TRUE
FOR COMMON INFRASTRUCTURE COMPONENTS



YAGNI:
YOU AIN‟T GOING TO
NEED IT
VIRTUOUS CIRCLE OF AGILITY
VIRTUOUS CIRCLE OF AGILITY

 STAKEHOLDERS WERE INCLUDED IN TDD

 INCREASED CONFIDENCE IN CORRECTNESS

 COMPARED FAVOURABLY WITH PREVIOUS EXPERIENCE
EXAMPLE

 IDENTIFICATION MODULE

 HIGH COMPLEXITY AND RISK

 ALL PARTIES INVOLVED IN ANALYSIS

 TESTS VERIFY IMPLEMENTATION

 HUMAN TESTER SIGNS OFF IMPLEMENTATION

 SUBSEQUENT CHANGES NOT BLOCKED BY MANAGEMENT

 CONFIDENCE HIGH
CONCLUSIONS

 TEST DRIVEN DEVELOPMENT IS WIDELY KNOWN

 PRACTICAL EXPERIENCE IS RARER

 INTRODUCTION CAN BE DIFFICULT

 THE TECHNIQUE BRINGS REWARDS

 REAL DIFFERENCE TO DELIVERY OF THE WEBNWALK PLATFORM
Andrew.Rendell@valtech.co.uk
http://twitter.com/anderew

http://www.valtech.co.uk
http://blog.valtech.co.uk
http://twitter.com/valtech

More Related Content

What's hot

What's hot (18)

50120140502011
5012014050201150120140502011
50120140502011
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
TDD (Test Driven Design)
TDD (Test Driven Design)TDD (Test Driven Design)
TDD (Test Driven Design)
 
Design for Testability
Design for Testability Design for Testability
Design for Testability
 
Wind River Test Management
Wind River Test ManagementWind River Test Management
Wind River Test Management
 
TDD Flow: The Mantra in Action
TDD Flow: The Mantra in ActionTDD Flow: The Mantra in Action
TDD Flow: The Mantra in Action
 
Introduction to TDD (Test Driven development) - Ahmed Shreef
Introduction to TDD (Test Driven development) - Ahmed ShreefIntroduction to TDD (Test Driven development) - Ahmed Shreef
Introduction to TDD (Test Driven development) - Ahmed Shreef
 
Design For Reliability
Design For ReliabilityDesign For Reliability
Design For Reliability
 
Rock Your Code with Code Contracts
Rock Your Code with Code ContractsRock Your Code with Code Contracts
Rock Your Code with Code Contracts
 
Advanced Verification Methodology for Complex System on Chip Verification
Advanced Verification Methodology for Complex System on Chip VerificationAdvanced Verification Methodology for Complex System on Chip Verification
Advanced Verification Methodology for Complex System on Chip Verification
 
ISE 7.1i Software
ISE 7.1i SoftwareISE 7.1i Software
ISE 7.1i Software
 
Reproducible Crashes: Fuzzing Pharo by Mutating the Test Methods
Reproducible Crashes: Fuzzing Pharo by Mutating the Test MethodsReproducible Crashes: Fuzzing Pharo by Mutating the Test Methods
Reproducible Crashes: Fuzzing Pharo by Mutating the Test Methods
 
Code coverage
Code coverageCode coverage
Code coverage
 
Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)
 
Unit testingandcontinousintegrationfreenest1dot4
Unit testingandcontinousintegrationfreenest1dot4Unit testingandcontinousintegrationfreenest1dot4
Unit testingandcontinousintegrationfreenest1dot4
 
Beyond Testing: Specs and Behavior Driven Development
Beyond Testing: Specs and Behavior  Driven DevelopmentBeyond Testing: Specs and Behavior  Driven Development
Beyond Testing: Specs and Behavior Driven Development
 
ISSRE 2008 Trip Report
ISSRE 2008 Trip ReportISSRE 2008 Trip Report
ISSRE 2008 Trip Report
 
TDD reloaded - JUGTAA 24 Ottobre 2012
TDD reloaded - JUGTAA 24 Ottobre 2012TDD reloaded - JUGTAA 24 Ottobre 2012
TDD reloaded - JUGTAA 24 Ottobre 2012
 

Viewers also liked

Test driven developement
Test driven developementTest driven developement
Test driven developement
Bhavik Panchal
 
BDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world applicationBDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world application
John Ferguson Smart Limited
 
Behavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile TestingBehavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile Testing
dversaci
 

Viewers also liked (11)

Test driven developement
Test driven developementTest driven developement
Test driven developement
 
Acceptance Test Driven Development at StarWest 2014
Acceptance Test Driven Development at StarWest 2014Acceptance Test Driven Development at StarWest 2014
Acceptance Test Driven Development at StarWest 2014
 
TDD: Test Driven Development 첫번째 이야기
TDD: Test Driven Development 첫번째 이야기TDD: Test Driven Development 첫번째 이야기
TDD: Test Driven Development 첫번째 이야기
 
BDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world applicationBDD in Action – principles, practices and real-world application
BDD in Action – principles, practices and real-world application
 
BDD presentation
BDD presentationBDD presentation
BDD presentation
 
Behavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile TestingBehavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile Testing
 
ATDD - Acceptance Test Driven Development
ATDD - Acceptance Test Driven DevelopmentATDD - Acceptance Test Driven Development
ATDD - Acceptance Test Driven Development
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven Development
 
BDD in Action - building software that matters
BDD in Action - building software that mattersBDD in Action - building software that matters
BDD in Action - building software that matters
 
Test Automation Strategies For Agile
Test Automation Strategies For AgileTest Automation Strategies For Agile
Test Automation Strategies For Agile
 

Similar to Effective and pragmatic test driven development by Andrew Rendell, Principal Consultant at Valtech

TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
Tieturi Oy
 
Evaluating Test Driven Development And Parameterized Unit Testing In Dot Net ...
Evaluating Test Driven Development And Parameterized Unit Testing In Dot Net ...Evaluating Test Driven Development And Parameterized Unit Testing In Dot Net ...
Evaluating Test Driven Development And Parameterized Unit Testing In Dot Net ...
mdfachowdhury
 

Similar to Effective and pragmatic test driven development by Andrew Rendell, Principal Consultant at Valtech (20)

Test Driven Development Andrew Rendell Valtech
Test Driven Development   Andrew Rendell   ValtechTest Driven Development   Andrew Rendell   Valtech
Test Driven Development Andrew Rendell Valtech
 
SOASTA CloudTest Lite
SOASTA CloudTest LiteSOASTA CloudTest Lite
SOASTA CloudTest Lite
 
Microservices Testing Strategies: The Good, the Bad, and the Reality
Microservices Testing Strategies: The Good, the Bad, and the RealityMicroservices Testing Strategies: The Good, the Bad, and the Reality
Microservices Testing Strategies: The Good, the Bad, and the Reality
 
Testing in a distributed world
Testing in a distributed worldTesting in a distributed world
Testing in a distributed world
 
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
 
Marc perillo
Marc perilloMarc perillo
Marc perillo
 
Testing micro services using testkits
Testing micro services using testkitsTesting micro services using testkits
Testing micro services using testkits
 
50120140502011
5012014050201150120140502011
50120140502011
 
What are Software Testing Methodologies | Software Testing Techniques | Edureka
What are Software Testing Methodologies | Software Testing Techniques | EdurekaWhat are Software Testing Methodologies | Software Testing Techniques | Edureka
What are Software Testing Methodologies | Software Testing Techniques | Edureka
 
system verilog
system verilogsystem verilog
system verilog
 
Testing in the cloud
Testing in the cloudTesting in the cloud
Testing in the cloud
 
Agile Open 2009 Tdd And Architecture Influences
Agile Open 2009   Tdd And Architecture InfluencesAgile Open 2009   Tdd And Architecture Influences
Agile Open 2009 Tdd And Architecture Influences
 
Evaluating Test Driven Development And Parameterized Unit Testing In Dot Net ...
Evaluating Test Driven Development And Parameterized Unit Testing In Dot Net ...Evaluating Test Driven Development And Parameterized Unit Testing In Dot Net ...
Evaluating Test Driven Development And Parameterized Unit Testing In Dot Net ...
 
Unit testing
Unit testingUnit testing
Unit testing
 
Peter Zimmerer - Evolve Design For Testability To The Next Level - EuroSTAR 2012
Peter Zimmerer - Evolve Design For Testability To The Next Level - EuroSTAR 2012Peter Zimmerer - Evolve Design For Testability To The Next Level - EuroSTAR 2012
Peter Zimmerer - Evolve Design For Testability To The Next Level - EuroSTAR 2012
 
CLOUD TESTING MODEL – BENEFITS, LIMITATIONS AND CHALLENGES
CLOUD TESTING MODEL – BENEFITS, LIMITATIONS AND CHALLENGESCLOUD TESTING MODEL – BENEFITS, LIMITATIONS AND CHALLENGES
CLOUD TESTING MODEL – BENEFITS, LIMITATIONS AND CHALLENGES
 
Cloud Native Dünyada CI/CD
Cloud Native Dünyada CI/CDCloud Native Dünyada CI/CD
Cloud Native Dünyada CI/CD
 
Test driven development v1.0
Test driven development v1.0Test driven development v1.0
Test driven development v1.0
 
San Jose Selenium Meet-up PushToTest TestMaker Presentation
San Jose Selenium Meet-up PushToTest TestMaker PresentationSan Jose Selenium Meet-up PushToTest TestMaker Presentation
San Jose Selenium Meet-up PushToTest TestMaker Presentation
 
'BIG Testing' with Hans Buwalda
'BIG Testing' with Hans Buwalda 'BIG Testing' with Hans Buwalda
'BIG Testing' with Hans Buwalda
 

More from Valtech UK

Presentation compressed
Presentation compressedPresentation compressed
Presentation compressed
Valtech UK
 
Using CFD, SPC and Kanban on UK GOV IT projects
Using CFD, SPC and Kanban on UK GOV IT projects Using CFD, SPC and Kanban on UK GOV IT projects
Using CFD, SPC and Kanban on UK GOV IT projects
Valtech UK
 

More from Valtech UK (20)

Get to know your users using Lean UX
Get to know your users using Lean UXGet to know your users using Lean UX
Get to know your users using Lean UX
 
The Art of Visualising Software - Simon Brown
The Art of Visualising Software - Simon BrownThe Art of Visualising Software - Simon Brown
The Art of Visualising Software - Simon Brown
 
Get to know your users
Get to know your users Get to know your users
Get to know your users
 
LeanUX and Agile in the Public Sector
LeanUX and Agile in the Public SectorLeanUX and Agile in the Public Sector
LeanUX and Agile in the Public Sector
 
Transforming nhs choices using agile and lean ux agile manc
Transforming nhs choices using agile and lean ux agile mancTransforming nhs choices using agile and lean ux agile manc
Transforming nhs choices using agile and lean ux agile manc
 
Digital Inclusion in the Public Sector
Digital Inclusion in the Public SectorDigital Inclusion in the Public Sector
Digital Inclusion in the Public Sector
 
Presentation compressed
Presentation compressedPresentation compressed
Presentation compressed
 
The Mobile Landscape - Do you really need an app?
The Mobile Landscape - Do you really need an app?The Mobile Landscape - Do you really need an app?
The Mobile Landscape - Do you really need an app?
 
Modern Digital Design: The power of Responsive Design
Modern Digital Design: The power of Responsive DesignModern Digital Design: The power of Responsive Design
Modern Digital Design: The power of Responsive Design
 
White Paper: "Designing Around People"
White Paper: "Designing Around People" White Paper: "Designing Around People"
White Paper: "Designing Around People"
 
Simplifying Facebook: Designing Around People
Simplifying Facebook: Designing Around PeopleSimplifying Facebook: Designing Around People
Simplifying Facebook: Designing Around People
 
The mobile landscape - Do you really need an app?
The mobile landscape - Do you really need an app?The mobile landscape - Do you really need an app?
The mobile landscape - Do you really need an app?
 
An Introduction to Responsive Design
An Introduction to Responsive DesignAn Introduction to Responsive Design
An Introduction to Responsive Design
 
Customer case - IC companys
Customer case - IC companysCustomer case - IC companys
Customer case - IC companys
 
Part 1: "Making Agile Work" Webinar Series: Inception
Part 1: "Making Agile Work" Webinar Series: InceptionPart 1: "Making Agile Work" Webinar Series: Inception
Part 1: "Making Agile Work" Webinar Series: Inception
 
Experience Report: FLIGHTGLOBAL.COM
Experience Report: FLIGHTGLOBAL.COMExperience Report: FLIGHTGLOBAL.COM
Experience Report: FLIGHTGLOBAL.COM
 
Agile UX integration
Agile UX integrationAgile UX integration
Agile UX integration
 
Agile in highly regulated environments
Agile in highly regulated environmentsAgile in highly regulated environments
Agile in highly regulated environments
 
Using CFD, SPC and Kanban on UK GOV IT projects
Using CFD, SPC and Kanban on UK GOV IT projects Using CFD, SPC and Kanban on UK GOV IT projects
Using CFD, SPC and Kanban on UK GOV IT projects
 
Adapting agile to the entreprise
Adapting agile to the entreprise Adapting agile to the entreprise
Adapting agile to the entreprise
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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...
 

Effective and pragmatic test driven development by Andrew Rendell, Principal Consultant at Valtech

  • 1. EFFECTIVE AND PRAGMATIC TEST DRIVEN DEVELOPMENT ANDREW RENDELL, PRINCIPAL CONSULTANT
  • 2. INTRODUCTION IS TDD REALLY UBIQUITOUS? EVALUATION OF THE APPLICATION OF TDD ON A REAL WORLD PROJECT IMPEDIMENTS AND THEIR RESOLUTION TANGIBLE BENEFITS
  • 3. PROJECT CONTEXT T-MOBILE MOBILE INTERNET PORTAL WEBNWALK3 PERSONALISED EXPERIENCE GO LIVE DATE INVARIANT
  • 4. DEVELOPMENT DYNAMIC STRONG CUSTOMER FOCUS COMMITMENT TO ERROR FREE USER EXPERIENCE CARRIER GRADE SOFTWARE QUALITY PRESSURE TO DELIVER MARKETING DRIVEN HIGHLY COMPETITIVE CONFLICTING DRIVERS RISK ADVERSE CONSERVATIVE HIGHLY COMPETITIVE RAPID ADAPTABILITY
  • 5. “VALTECH BELIEVES THAT AGILE, AND IN PARTICULAR TEST DRIVEN DEVELOPMENT CAN HELP THESE COMPANIES DELIVER QUICKLY AND SAFELY.”
  • 6. MAKING A PROJECT TEST DRIVEN
  • 7. MAKING A PROJECT TEST DRIVEN WHERE WE STARTED HOW THE INTENT WAS COMMUNICATED STRUCTURING THE APPLICATION TO STRUCTURE DEVELOPMENT ACTIVITIES HUMAN INTERACTION WITH DEVELOPERS
  • 8. MAKING A PROJECT TEST DRIVEN DEVELOPERS EXPERIENCE ONE OR TWO WITH TDD EXPERIENCE // MOST HAD GOOD UNDERSTANDING OF TDD THEORY // ALMOST ALL HAD USED JUNIT // MOST HIGH CALIBRE JAVA DEVELOPERS
  • 9. MAKING A PROJECT TEST DRIVEN MANAGEMENT EXPERIENCE EXPERTS IN MOBILE TELCO // GOOD UNDERSTANDING OF AGILE THEORY // READY TO EMBRACE NEW PRACTICES // LONG HISTORY OF WATERFALL, DOCUMENT CENTRIC
  • 10. MAKING A PROJECT TEST DRIVEN AT INCEPTION NO INTENT TO USE TDD END OF INCEPTION SOME JUNIT TESTS // DECIDE TO USE TDD // MEASURE EXISTING COVERAGE // AUDIT EXISTING USE OF TESTS
  • 11. COMMUNICATING THE INTENT MOST IMPORTANT INTERACTIVE SESSIONS TEAM WAS INEXPERIENED ACCEPTED INEVITABILITY OF MAKING MISTAKES
  • 12. TDD THROUGH APPLICATION STRUCTURE WEBNWALK IS A STANDARD MVC APPLICATION INDENTIFIED INTEGRATION PAIN POINT PRESENTATION LAYER / SERVER SIDE DIFFERENT TEAMS, SKILLS, COMPLEXITY, TIMESCALES RIGOROUS DEFINITION OF INTERFACE THROUGH CONTRACT CONTRACT BECOMES STARTING POINT OF DEVELOPMENT
  • 13. EmailWidgetService XXXEmailContract +customerNotAuthenticatedWithPartner() : EmailWidgetModel +oneReadOneUnreadEmail() : EmailWidgetModel +noUneadEmailFiveReadEmail() : EmailWidgetModel +noEmai() : EmailWidgetModel +manyEmails() : EmailWidgetModel +errorGettingEmails() : EmailWidgetModel XXXEmailAcceptanceTest JUnit4 Test XXXEmailWidgetService
  • 14. TOP DOWN DEVELOPMENT Tests EmailAcceptanceTest EmailWidgetService Tests EmailWidgetServiceImplTest EmailWidgetServiceImpl Uses CustomerDAO Tests CustomerDAOImplTest CustomerDAOImpl
  • 15. RESPECT // EMPOWERMENT // AVOID DOGMA // IN RETROSPECT, TOO MUCH FLEXIBILITY ALLOWED, ESPECIALLY FOR LESS EXPERIENCED DEVELOPERS RESPECTING THE DEVELOPERS FREEDOM
  • 17.
  • 18.
  • 19.
  • 20. DISILLUSIONMENT PATTERN SEEN ON SEVERAL PROJECTS COMMON AMONGST NEW PRACTITIONERS EVERYONE WENT THROUGH SOME OF THE STAGES
  • 21. DISILLUSIONMENT TOO FOCUSED ON TDD AS AN OBJECTIVE RATHER THAN AS A VEHICLE VELOCITY BEING MEASURED FOR FIRST TIME HIGHLIGHTS SLIPPAGE TDD BLAMED
  • 22. DOGMATIC APPLICATION ALL NEWCOMERS TO TDD AFFECTED, NOT JUST THOSE LESS EXPERIENCED IN TOOLSET TOO FOCUSED ON THE APPLICATION OF THE TECHNIQUE FAILURE TO PERCEIVE THE DIFFERENT IN VALUE OF DIFFERENT TESTS
  • 23. DOGMATIC APPLICATION BEST DEVELOPERS FOCUSED ON WHY TESTS WERE BEING WRITTEN WROTE AND REWROTE CLASSES TO EXPEDITE TESTING VIEWED INCORRECTLY AS „FAILURE‟ BY NEW DEVELOPERS
  • 24. TRIVIAL EXAMPLE AverageDurationAnalyserImpl.java /** * Obtains the current time. * protected so can be overridden in unit test */ protected long getCurrentTime() { return System.currentTimeMillis(); } AverageDurationAnalyserImplTest.java private static long RIGHT_NOW = 1000; @Before public void onSetup() { analyser = new AverageDurationAnalyserImpl(){ @Override protected long getCurrentTime() {return RIGHT_NOW ;}}; }
  • 26. MEASURABLE BENEFITS IMPROVED CODE STRUCTURE // LESS REDUNDANT EFFORT// VIRTUOUS CIRCLE
  • 27. IMPROVED COHESION STRONG COHESION IS ONE OF THE MOST IMPORTANT ATTRIBUTES OF WELL STRUCTURED CODE TDD NATURALLY ENCOURAGES COHESION TOP DOWN APPROACH MEANS RESPONSIBILITY IS WELL UNDERSTOOD BEFORE CODE IS BEGUN WRITING A TEST WHICH HAS MORE THAN ONE SET OF GOALS IS AN OBVIOUS BAD SMELL AND INDICATES TIME TO DELEGATE
  • 28. LOW COHESION Logic for implementation of transformation Http Client implemented piecemeal for several classes AuctionWidgetModel Tests WidgetService Worker HmlService Tests Tests AuctionWidgetModelTest Tests WorkerTest Tests +testSelling() +testCombineWatchingAndBuyingTotals() Tests Logic for testing data transformation HmlServiceTest Tests implemented in several different classes +testWatchingData()
  • 29. HIGH COHESION All data transformation logic encapsulated in Xml Adaptor. All tests and test data in XmlAdaptorTest. WidgetService Worker HttpClient AuctionWidgetModel XmlAdaptor Tests XmlAdaptorTest
  • 30. A COMMON PROBLEM // TDD ENCOURAGES FOCUS ON WHAT IS REQUIRED // DISCOURAGES SPECULATION SEEMS PARTICULARLY TRUE FOR COMMON INFRASTRUCTURE COMPONENTS YAGNI: YOU AIN‟T GOING TO NEED IT
  • 32. VIRTUOUS CIRCLE OF AGILITY STAKEHOLDERS WERE INCLUDED IN TDD INCREASED CONFIDENCE IN CORRECTNESS COMPARED FAVOURABLY WITH PREVIOUS EXPERIENCE
  • 33. EXAMPLE IDENTIFICATION MODULE HIGH COMPLEXITY AND RISK ALL PARTIES INVOLVED IN ANALYSIS TESTS VERIFY IMPLEMENTATION HUMAN TESTER SIGNS OFF IMPLEMENTATION SUBSEQUENT CHANGES NOT BLOCKED BY MANAGEMENT CONFIDENCE HIGH
  • 34.
  • 35. CONCLUSIONS TEST DRIVEN DEVELOPMENT IS WIDELY KNOWN PRACTICAL EXPERIENCE IS RARER INTRODUCTION CAN BE DIFFICULT THE TECHNIQUE BRINGS REWARDS REAL DIFFERENCE TO DELIVERY OF THE WEBNWALK PLATFORM