Effective and pragmatic test driven development by Andrew Rendell, Principal Consultant at Valtech
Upcoming SlideShare
Loading in...5
×
 

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

on

  • 1,082 views

Andrew Rendell's presentation on test driven developement.

Andrew Rendell's presentation on test driven developement.
The presentation will discuss if TDD is really ubiquitous
and evaluate the application of TDD on a real world project!

Statistics

Views

Total Views
1,082
Views on SlideShare
1,077
Embed Views
5

Actions

Likes
1
Downloads
8
Comments
0

1 Embed 5

http://blog.valtech.co.uk 5

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

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

  • EFFECTIVE AND PRAGMATIC TEST DRIVEN DEVELOPMENTANDREW 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 BELIEVESTHAT AGILE, AND INPARTICULAR TESTDRIVEN DEVELOPMENTCAN HELP THESECOMPANIES DELIVERQUICKLY 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, TOOMUCH FLEXIBILITY ALLOWED, ESPECIALLY FOR LESS EXPERIENCEDDEVELOPERSRESPECTING THEDEVELOPERS FREEDOM
  • IMPEDIMENTS AND PITFALLSDISILLUSINMENT // 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 BENEFITSIMPROVED CODESTRUCTURE //LESS REDUNDANTEFFORT//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 COHESIONLogic for implementation of transformation Http Clientimplemented piecemeal for several classesAuctionWidgetModel Tests WidgetService Worker HmlService Tests TestsAuctionWidgetModelTest 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 ISREQUIRED // DISCOURAGES SPECULATION SEEMS PARTICULARLY TRUEFOR COMMON INFRASTRUCTURE COMPONENTSYAGNI:YOU AIN‟T GOING TONEED 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.ukhttp://twitter.com/anderewhttp://www.valtech.co.ukhttp://blog.valtech.co.ukhttp://twitter.com/valtech