test-driven development. as itshouldbe. · test driven development run the tests make a little...

of 26 /26
1 ©2007 SYSOPENDIGIA Plc Test-Driven Development. As it should be. Jarno Keskikangas Project Manager Digia Plc

Author: others

Post on 19-Jul-2020

0 views

Category:

Documents


0 download

Embed Size (px)

TRANSCRIPT

  • 1 ©2007 SYSOPENDIGIA Plc

    Test-Driven Development.As it should be.

    Jarno Keskikangas

    Project Manager

    Digia Plc

  • 2 ©2007 SYSOPENDIGIA Plc

    Outline

    • Me, You and the Company

    • Agile software development in general and TDD in particular

    • Test-Driven Development in a nutshell

    • Lessons learnt & summary

    • Q & A

  • 3 ©2007 SYSOPENDIGIA Plc

    Me, You and the Company

  • Me

    • Agile advocate

    • practitioner rather than researcher

    • focus on the bottom line

    • Introducing and implementing TDD practices to own organization and other entities

    • Currently working as a scrum master and projectmanager

    • ...with software developer background

    4 ©2007 SYSOPENDIGIA Plc

  • You

    • Familiar with agile principles

    • Comfortable with xUnit frameworks

    • Have heard or tried TDD

    • Will have the time of your life during the presentation

    …In a way or other =)

    5 ©2007 SYSOPENDIGIA Plc

  • 6 ©2007 SYSOPENDIGIA Plc

    Outline...and the Company, Digia Plc

    • Modern and agile software house

    • Complete solution offering

    • Business critical ICT solutions

    • Forerunner in mobile and wireless solutions

    • Focused market segments

    • Telecommunications

    • Industry and Trade

    • Finance and Services

    • Listed on the Nordic Exchange

    • Headquarters in Helsinki, offices in Estonia, Sweden and other locations in Finland

    • Pro forma turnover in 2006 EUR 98.9 million

    • Employs over 1100 professionals

  • 7 ©2007 SYSOPENDIGIA Plc

    Telecommunications Division

    • Agile partner creating mobile software development services and solutions

    • Trusted player providing business process improvement, integration and systems development

    • Innovative forerunner building ICT solutions utilising mobile opportunities

    • Employing over 550 professionals

    Handset

    Industry

    Operators&

    Media

    Corporations

    Integrating Innovations

  • 8 ©2007 SYSOPENDIGIA Plc

    Agile software development in general and TDD in particular

  • 9 ©2007 SYSOPENDIGIA Plc

    Agile Software Development

    • Iterative and incremental development

    • Close collaboration between business people and programmers

    • Empowered and self-organized teams

    • Working software as the primary measure of progress

    Time

    Risk

    Agile project

    Waterfall project

    Time

    Cost of change

  • Test-Driven Development. As it should be.

  • 11 ©2007 SYSOPENDIGIA Plc

    Test Driven Development

    Run

    the tests

    Make a little

    change

    Add a test

    Run

    the tests

    [Pass]

    [Fail]

    [Fail] [Pass, Development continues]

    [Pass, Development stops]

    Specification

    Design

    Development

    Testing

  • 12 ©2007 SYSOPENDIGIA Plc

    How to write good TDD specifications?

    • What’s the next most important thing the system doesn’t do?

    • Template for TDD scenarios

    • Given some initial context (the givens)

    • When an event occurs

    • Then ensure some outcomes

  • 13 ©2007 SYSOPENDIGIA Plc

    Emerging design and mock objects

    Test class

    Domain object

    Mock object

    Test class

    Domain object

    Mock object

  • To see is to believe

  • EUnit Test Creation Wizards/*/*

    ----------------------------------------------------------------------------------------------------------------------------------------------------------

    This file has been generated with This file has been generated with EUnitEUnit ProPro

    http://http://www.sysopendigia.com/qualitykitwww.sysopendigia.com/qualitykit

    ----------------------------------------------------------------------------------------------------------------------------------------------------------

    */*/

    ##ifndefifndef __CMYTRIANGLE_TESTI_H____CMYTRIANGLE_TESTI_H__

    #define __CMYTRIANGLE_TESTI_H__#define __CMYTRIANGLE_TESTI_H__

    // INCLUDES// INCLUDES

    #include

    #include

    #include "#include "CMyTriangle.hCMyTriangle.h""

    // FORWARD DECLARATIONS// FORWARD DECLARATIONS

    // CLASS DEFINITION// CLASS DEFINITION

    /**/**

    * Generated * Generated EUnitEUnit test suite class.test suite class.

    */*/

    NONSHARABLE_CLASS( NONSHARABLE_CLASS( CMyTriangle_TestiCMyTriangle_Testi ))

    : public : public CEUnitTestSuiteClassCEUnitTestSuiteClass

    {{

    public: // Constructors and destructorpublic: // Constructors and destructor

    static static CMyTriangle_TestiCMyTriangle_Testi* * NewLNewL();();

    static static CMyTriangle_TestiCMyTriangle_Testi* * NewLCNewLC();();

    ~~CMyTriangle_TestiCMyTriangle_Testi();();

    private: // Constructorsprivate: // Constructors

    CMyTriangle_TestiCMyTriangle_Testi();();

    void void ConstructLConstructL();();

    private: // New methodsprivate: // New methods

    void void SetupLSetupL();();

    void Teardown();void Teardown();

    void void T_Global_AreaLT_Global_AreaL();();

    void void T_Global_CMyTriangleLT_Global_CMyTriangleL();();

    void void T_Global_CenterLT_Global_CenterL();();

    void void T_Global_CrossProductLT_Global_CrossProductL();();

    void void T_Global_FirstCornerLT_Global_FirstCornerL();();

  • EUnit Test ExecutionEUnitEUnit S60 S60 GuiGui

    ConnectivityConnectivity

    DeviceDevice

    RPM RPM serverserver and and devicedevice poolpool

    EUnitExeRunnerEUnitExeRunner

    Carbide.CCarbide.C++ ++ EUnitEUnit ViewView

    TestTest ManagerManager

  • Lessons learnt

  • 18 ©2007 SYSOPENDIGIA Plc

    Developer questionnaire

    1. Facilitates better requirements

    2. Reduces debugging effort

    3. Reduces development time

    4. Yields higher code quality

    5. Promotes simpler design

    6. Is noticeably effective

    7. Getting into TDD mindset

    8. Lack of upfront design is a hindrance

    0 1 2 3 4 5

    1

    2

    3

    4

    5

    6

    7

    8

    Qu

    esti

    on

    Mean Standard Deviation

  • 19 ©2007 SYSOPENDIGIA Plc

    Testimonials

    • 3. Jos voit valita vapaasti, käytätkö mieluummin TDD-tekniikkaa vaijotain muuta lähestymistapaa? Miksi?

    “Ehdottomasti TDD. Mikäli unit testejä tehdään jollain muulla keinolla neeivät yleensä osu ongelman ytimeen vaan harrastetaan koodikattavuudengenerointia esim. Tarkistelemalla raja-arvoja.”

    “Mielellään TDD:tä, koska silloin automaattisesti päädytään testattavaan jayleensä toimivaan designiin. Koodin laatu pysyy koko kehitystyön ajanhyvänä.”

    • 2. Kuvaile kohtaamiasi ongelmia TDD-tekniikan soveltamisessa. Miten ongelmia voisi mielestäsi vähentää?

    “Suurimmat ongelmat syntyvät vanhojen partojen pinttyneistä tavoistasuunnitella kaikki etukäteen eli ei anneta TDD:n tehdä sitä mihin se on tarkoitettu.”

    “Huono design: konkreettiset riippuvuudet, sykliset riippuvuudet, luokillamonta vastuuta. Luokat pitäisi suunnitella niin, että ne voidaanyksikkötestata.”

  • Summary

  • TDD is not about testing. It’sabout specification, design and

    testing.

  • TDD is essential element of agilesoftware engineering.

  • Agile software engineeringis harder to adopt than

    agile project management.

  • Pay now or pay later. The lateryou pay, the higher the K.

  • 25 ©2007 SYSOPENDIGIA Plc

    Testimonials

    [email protected]

    Thank You!

  • 26 ©2007 SYSOPENDIGIA Plc

    References

    • http://blog.daveastels.com/files/BDD_Intro.pdf

    • Scott Ambler: Introduction to Test Driven Designhttp://www.agiledata.org/essays/tdd.html

    • Dan North: Introducing BDDhttp://dannorth.net/introducing-bdd/

    • Boby Georgea, Laurie Williams: A structured experiment of test-driven development

    • Dozens of research papers, see ACM and IEEE electronic libraries