SlideShare una empresa de Scribd logo
1 de 32
Descargar para leer sin conexión
Open Source Jumpstart:
 Improve your development
           Skills




©LeanAgileMachine
Creative Commons License
Graduate Developer
                 Community


                           Meet with Companies
 www.grad-dc.co.uk         looking for interns
                    Talk to experienced
 blog.grad-dc.co.uk developers & testers
                           Ask questions about
                           what you learnt
                           tonight
©LeanAgileMachine
Creative Commons License   Socialse
Goals of OS Jumpstart

 ●   What tools are out there
 ●   What should you know
 ●   Show how Unit Testing tools support the agile
     process




©LeanAgileMachine
Creative Commons License
Goals of this session
 ●   Understand the value of TDD
 ●   Give you confidence to start learning TDD
 ●   Tools to use to start learning
     ●   I cant teach you TDD in one evening, sorry!
     ●   TDD is as big as learning something like OO
 ●   A bit of practical experience
     ●   Pair up and try it out
 ●   Deliberate practice
©LeanAgileMachine
Creative Commons License
Have you tried ”Test First” ?

  Raise your hand if you already tried TDD and
  ”test first” development ?




©LeanAgileMachine
Creative Commons License
Where does TDD fit




©LeanAgileMachine
Creative Commons License
So what is TDD ??




©LeanAgileMachine
Creative Commons License
A design activity
 ●   What is the challenge (the requirements)
 ●   What are the concepts we are dealing with
 ●   What is valuable
 ●   What behaviour do I need to understand
 ●   How do I know I have met the challenge
 ●   How do I know I can change



©LeanAgileMachine
Creative Commons License
Understanding the problem
 ●   Behaviour
 ●   Concepts
 ●   Stakeholders
 ●   Values
 ●   Priorities




©LeanAgileMachine
Creative Commons License
The TDD cycle
 ●   Write a failing test so
     we know it tests
     something
 ●   Write code to make
     the test pass
 ●   Refactor code to be
     as simple as possible



©LeanAgileMachine
Creative Commons License
Continuous / Fast Feedback
●   Are we there yet ?
●   Your own ”mini-me” tester as a guide
    ●   Only scratching the surface of testing though




©LeanAgileMachine
Creative Commons License
What tools are involved




                           Jenkins CI

©LeanAgileMachine
Creative Commons License
Anatomy of a test




©LeanAgileMachine
Creative Commons License
Make the test compile




©LeanAgileMachine
Creative Commons License
Write a class




©LeanAgileMachine
Creative Commons License
Common assertions
 ●   assertEquals()
     ●   Two objects of the same type are equal in value
 ●   assertNotNull()
     ●   The object does not have a null value
 ●   assertTrue()
     ●   The statement results is a true evaluation
 ●   assertSame()
     ●   Two objects are the same
  http://junit.sourceforge.net/javadoc/org/junit/Assert.html

©LeanAgileMachine
Creative Commons License
JUnit Annotations
●   @Test
                                                  ●   @Ignore
     ●    Defines a method as a test
                                                      ●   Dont run this
●   @Test(expected=exception.class)                       test – use
     ●    Fails if a specific exception is no             sparingly
          thrown
●   @Test(timeout = 1000)
     ●    Fails if test takes too long
          (milliseconds)
         http://junit.sourceforge.net/javadoc/org/junit/Test.html
    ©LeanAgileMachine
    Creative Commons License
Test ”smells”
 ●   Testing code rather
     than behaviour             ●   Multiple assertions
     ●   Too specific               per method
     ●   Changing tests every       ●   Bloated tests
         time you refactor          ●   Harder to refactor
                                    ●   Addressing to many
                                        scenarios
                                    ●   Harder to understand
                                        and maintain

©LeanAgileMachine
Creative Commons License
A bad test example
    @Test
    public void equalsCheck() {
      System.out.println("* VectorsJUnit4Test: equalsCheck()");
      assertTrue(Vectors.equal(new int[] {}, new int[] {}));
      assertTrue(Vectors.equal(new int[] {0}, new int[] {0}));
      assertTrue(Vectors.equal(new int[] {0, 0}, new int[] {0, 0}));
      assertTrue(Vectors.equal(new int[] {0, 0, 0}, new int[] {0, 0, 0}));
      assertTrue(Vectors.equal(new int[] {5, 6, 7}, new int[] {5, 6, 7}));

        assertFalse(Vectors.equal(new int[] {}, new int[] {0}));
        assertFalse(Vectors.equal(new int[] {0}, new int[] {0, 0}));
        assertFalse(Vectors.equal(new int[] {0, 0}, new int[] {0, 0, 0}));
        assertFalse(Vectors.equal(new int[] {0, 0, 0}, new int[] {0, 0}));
        assertFalse(Vectors.equal(new int[] {0, 0}, new int[] {0}));
        assertFalse(Vectors.equal(new int[] {0}, new int[] {}));

        assertFalse(Vectors.equal(new int[] {0, 0, 0}, new int[] {0, 0, 1}));
        assertFalse(Vectors.equal(new int[] {0, 0, 0}, new int[] {0, 1, 0}));
        assertFalse(Vectors.equal(new int[] {0, 0, 0}, new int[] {1, 0, 0}));
        assertFalse(Vectors.equal(new int[] {0, 0, 1}, new int[] {0, 0, 3}));
    }
©LeanAgileMachine
Creative Commons License
Quick Netbeans / JUnit demo

       - create a new project
       - create your first test
       - run the JUnit testrunner
       - write code to fix the test
       - run the JUnit testrunner
       - write another test...


©LeanAgileMachine
Creative Commons License
Your turn
                       - pair up
                - fire up netbeans
     - start a new Java Application project
            - or check out my project
         - read the basic requirements
                   - write a test...



©LeanAgileMachine
Creative Commons License
Deliberate practice
●   Goal is to practice TDD
    ●   Become comfortable with the tools
    ●   Gain experience in writing tests
    ●   Improve confidence in TDD



●   The resulting code algorithms are not important
    ●   I dont care how fast your calculator calculates
    ●   You're here to learn not to produce
©LeanAgileMachine
Creative Commons License
Hamcrest asserts
 ●   Hamcrest is a pattern matching library
     ●   Can help make you test logic more human readable

      AssertThat() - instead of JUnit asserts

     assertThat(myCalc.addTwoNumbers(6, 7),
             is(6 + 7));

     assertThat(myCalc.addTwoNumbers(6, 7),
             is(not(6 + 9)));

©LeanAgileMachine
Creative Commons License
Build Tools
 ●   Build Automation
     ●   Compile, test and deploy code
         from your repository

                                   Ant.apache.org
                                   ant.apache.org/ivy

                                   Maven.apache.org

                                   Comparison of tools:
                                     http://ant.apache.org/ivy/
                                     m2comparison.html
©LeanAgileMachine
Creative Commons License
Integrated Development
                     Environments
●   Manage large / multiple projects
    ●   Debugger
    ●   Autocompletion (code api completion)
    ●   Refactoring                                                .org
●   Build management
        Ant / Maven – compile, test, deploy
                                                                  .org
    ●


●   Integration
    ●   Application servers, databases, unit testing,
        Scm, bug tracker, CI server,                    IntelliJ IDEA
                                                        jetbrains.org


©LeanAgileMachine
Creative Commons License
Keep the build bunny happy
●   Tests help prevent
    build errors

●   You can run your
    tests before you
    anger the build
    bunny




©LeanAgileMachine
Creative Commons License
Collaborative workspace
 ●   Can show progress of your
     tests
                                 Confluence
 ●   Show you which tests are
     failing
 ●   Gives everyone a sence of
     progress




©LeanAgileMachine
Creative Commons License
Summary
 ●   TDD is a design activity
     ●   Gives you time to use your brain before coding
 ●   This session was just enough to get you going
 ●   Try doing some coding kata
 ●   Try a coding dojo or code retreat
     ●   LJC / GDC organising these soon !
     ●   Monthly Python, Clojure, Scala dojos aready
         running

©LeanAgileMachine
Creative Commons License
We want your feedback




©LeanAgileMachine
Creative Commons License
Graduate Developer
                 Community
www.grad-dc.co.uk
                           Meet with Companies
blog.grad-dc.co.uk         looking for interns
                           Talk to experienced
                           developers & testers
                           Ask questions about
                           what you learnt
                           tonight
                           Socialse
©LeanAgileMachine
Creative Commons License
TDD / BDD Workshop
 ●
     Half day workshop at SkillsMatter 17 th May
     ●   Part of London Tester Gathering days



     http://bit.ly/LTGDays2011



©LeanAgileMachine
Creative Commons License
Thank you
Useful links
John@jr0cket.com
John.Jr0cket.co.uk
Toolingup.Jr0cket.co.uk
Ubuntu.Jr0cket.co.uk
                                Growing OO Software,
www.grad-dc.co.uk               guided by tests
blog.grad-dc.co.uk

 ©LeanAgileMachine
 Creative Commons License

Más contenido relacionado

La actualidad más candente

Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy CodeAdam Culp
 
Win at life with unit testing
Win at life with unit testingWin at life with unit testing
Win at life with unit testingmarkstory
 
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)Kaunas Java User Group
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven DevelopmentTung Nguyen Thanh
 
Working Effectively With Legacy Code
Working Effectively With Legacy CodeWorking Effectively With Legacy Code
Working Effectively With Legacy CodeExcella
 
Working with Legacy Code
Working with Legacy CodeWorking with Legacy Code
Working with Legacy CodeEyal Golan
 
Adding Unit Test To Legacy Code
Adding Unit Test To Legacy CodeAdding Unit Test To Legacy Code
Adding Unit Test To Legacy CodeTerry Yin
 
Acceptance Test Driven Development With Spec Flow And Friends
Acceptance Test Driven Development With Spec Flow And FriendsAcceptance Test Driven Development With Spec Flow And Friends
Acceptance Test Driven Development With Spec Flow And FriendsChristopher Bartling
 
Keyword Driven Testing
Keyword Driven TestingKeyword Driven Testing
Keyword Driven TestingMaveryx
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010guest5639fa9
 

La actualidad más candente (20)

Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy Code
 
Angular Unit Test
Angular Unit TestAngular Unit Test
Angular Unit Test
 
BDD for APIs
BDD for APIsBDD for APIs
BDD for APIs
 
Win at life with unit testing
Win at life with unit testingWin at life with unit testing
Win at life with unit testing
 
Bdd and spec flow
Bdd and spec flowBdd and spec flow
Bdd and spec flow
 
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
 
Automation and Technical Debt
Automation and Technical DebtAutomation and Technical Debt
Automation and Technical Debt
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
 
Working Effectively With Legacy Code
Working Effectively With Legacy CodeWorking Effectively With Legacy Code
Working Effectively With Legacy Code
 
Working with Legacy Code
Working with Legacy CodeWorking with Legacy Code
Working with Legacy Code
 
Adding Unit Test To Legacy Code
Adding Unit Test To Legacy CodeAdding Unit Test To Legacy Code
Adding Unit Test To Legacy Code
 
Acceptance Test Driven Development With Spec Flow And Friends
Acceptance Test Driven Development With Spec Flow And FriendsAcceptance Test Driven Development With Spec Flow And Friends
Acceptance Test Driven Development With Spec Flow And Friends
 
Keyword Driven Testing
Keyword Driven TestingKeyword Driven Testing
Keyword Driven Testing
 
Automated tests to a REST API
Automated tests to a REST APIAutomated tests to a REST API
Automated tests to a REST API
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010
 
Web tech: lecture 5
Web tech: lecture 5Web tech: lecture 5
Web tech: lecture 5
 
Serenity-BDD training
Serenity-BDD trainingSerenity-BDD training
Serenity-BDD training
 
TDD & BDD
TDD & BDDTDD & BDD
TDD & BDD
 
TDD - Agile
TDD - Agile TDD - Agile
TDD - Agile
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 

Similar a Improve your development skills with Test Driven Development

Open Source Jumpstart Tooling Up Intro
Open Source Jumpstart Tooling Up IntroOpen Source Jumpstart Tooling Up Intro
Open Source Jumpstart Tooling Up IntroSkills Matter
 
Agile Days Twin Cities 2011
Agile Days Twin Cities 2011Agile Days Twin Cities 2011
Agile Days Twin Cities 2011Brian Repko
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkPeter Kofler
 
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)Lars Thorup
 
Javascript Unit Testing Tools
Javascript Unit Testing ToolsJavascript Unit Testing Tools
Javascript Unit Testing ToolsPixelCrayons
 
Django strategy-test
Django strategy-testDjango strategy-test
Django strategy-testRoyce Haynes
 
Dot all 2019 | Testing with Craft | Giel Tettelar
Dot all 2019 | Testing with Craft | Giel TettelarDot all 2019 | Testing with Craft | Giel Tettelar
Dot all 2019 | Testing with Craft | Giel TettelarGiel Tettelaar
 
Java Tech & Tools | Continuous Delivery - the Writing is on the Wall | John S...
Java Tech & Tools | Continuous Delivery - the Writing is on the Wall | John S...Java Tech & Tools | Continuous Delivery - the Writing is on the Wall | John S...
Java Tech & Tools | Continuous Delivery - the Writing is on the Wall | John S...JAX London
 
Continuous delivery - JAX London 2011
Continuous delivery - JAX London 2011Continuous delivery - JAX London 2011
Continuous delivery - JAX London 2011John Stevenson
 
Beginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBeginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBaskar K
 
High Performance Software Engineering Teams
High Performance Software Engineering TeamsHigh Performance Software Engineering Teams
High Performance Software Engineering TeamsLars Thorup
 
Unit testing for ext js apps using sencha test - Walkingtree Technologies
Unit testing for ext js apps using sencha test - Walkingtree TechnologiesUnit testing for ext js apps using sencha test - Walkingtree Technologies
Unit testing for ext js apps using sencha test - Walkingtree TechnologiesWalking Tree Technologies
 
Test Driven Development Introduction
Test Driven Development IntroductionTest Driven Development Introduction
Test Driven Development IntroductionNguyen Hai
 
Test driven development_continuous_integration
Test driven development_continuous_integrationTest driven development_continuous_integration
Test driven development_continuous_integrationhaochenglee
 
Front-End Modernization for Mortals
Front-End Modernization for MortalsFront-End Modernization for Mortals
Front-End Modernization for Mortalscgack
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernizationdevObjective
 
Intro to java test frameworks
Intro to java test frameworksIntro to java test frameworks
Intro to java test frameworksLim Sim
 

Similar a Improve your development skills with Test Driven Development (20)

Open Source Jumpstart Tooling Up Intro
Open Source Jumpstart Tooling Up IntroOpen Source Jumpstart Tooling Up Intro
Open Source Jumpstart Tooling Up Intro
 
Agile Days Twin Cities 2011
Agile Days Twin Cities 2011Agile Days Twin Cities 2011
Agile Days Twin Cities 2011
 
Unit testing (eng)
Unit testing (eng)Unit testing (eng)
Unit testing (eng)
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test Framework
 
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)
 
Javascript Unit Testing Tools
Javascript Unit Testing ToolsJavascript Unit Testing Tools
Javascript Unit Testing Tools
 
Django strategy-test
Django strategy-testDjango strategy-test
Django strategy-test
 
Dot all 2019 | Testing with Craft | Giel Tettelar
Dot all 2019 | Testing with Craft | Giel TettelarDot all 2019 | Testing with Craft | Giel Tettelar
Dot all 2019 | Testing with Craft | Giel Tettelar
 
Java Tech & Tools | Continuous Delivery - the Writing is on the Wall | John S...
Java Tech & Tools | Continuous Delivery - the Writing is on the Wall | John S...Java Tech & Tools | Continuous Delivery - the Writing is on the Wall | John S...
Java Tech & Tools | Continuous Delivery - the Writing is on the Wall | John S...
 
Continuous delivery - JAX London 2011
Continuous delivery - JAX London 2011Continuous delivery - JAX London 2011
Continuous delivery - JAX London 2011
 
Beginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBeginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NET
 
High Performance Software Engineering Teams
High Performance Software Engineering TeamsHigh Performance Software Engineering Teams
High Performance Software Engineering Teams
 
Unit testing for ext js apps using sencha test - Walkingtree Technologies
Unit testing for ext js apps using sencha test - Walkingtree TechnologiesUnit testing for ext js apps using sencha test - Walkingtree Technologies
Unit testing for ext js apps using sencha test - Walkingtree Technologies
 
Test Driven Development Introduction
Test Driven Development IntroductionTest Driven Development Introduction
Test Driven Development Introduction
 
Tasting Your First Test Burger
Tasting Your First Test BurgerTasting Your First Test Burger
Tasting Your First Test Burger
 
Test driven development_continuous_integration
Test driven development_continuous_integrationTest driven development_continuous_integration
Test driven development_continuous_integration
 
Front-End Modernization for Mortals
Front-End Modernization for MortalsFront-End Modernization for Mortals
Front-End Modernization for Mortals
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernization
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernization
 
Intro to java test frameworks
Intro to java test frameworksIntro to java test frameworks
Intro to java test frameworks
 

Más de John Stevenson

ClojureX Conference 2017 - 10 amazing years of Clojure
ClojureX Conference 2017 - 10 amazing years of ClojureClojureX Conference 2017 - 10 amazing years of Clojure
ClojureX Conference 2017 - 10 amazing years of ClojureJohn Stevenson
 
Confessions of a developer community builder
Confessions of a developer community builderConfessions of a developer community builder
Confessions of a developer community builderJohn Stevenson
 
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in ClojurescriptProgscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in ClojurescriptJohn Stevenson
 
Introduction to Functional Reactive Web with Clojurescript
Introduction to Functional Reactive Web with ClojurescriptIntroduction to Functional Reactive Web with Clojurescript
Introduction to Functional Reactive Web with ClojurescriptJohn Stevenson
 
Thinking Functionally with Clojure
Thinking Functionally with ClojureThinking Functionally with Clojure
Thinking Functionally with ClojureJohn Stevenson
 
Communication improbable
Communication improbableCommunication improbable
Communication improbableJohn Stevenson
 
Getting into public speaking at conferences
Getting into public speaking at conferencesGetting into public speaking at conferences
Getting into public speaking at conferencesJohn Stevenson
 
Functional web with clojure
Functional web with clojureFunctional web with clojure
Functional web with clojureJohn Stevenson
 
Get into Functional Programming with Clojure
Get into Functional Programming with ClojureGet into Functional Programming with Clojure
Get into Functional Programming with ClojureJohn Stevenson
 
Guiding people into Clojure
Guiding people into ClojureGuiding people into Clojure
Guiding people into ClojureJohn Stevenson
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperJohn Stevenson
 
Get Functional Programming with Clojure
Get Functional Programming with ClojureGet Functional Programming with Clojure
Get Functional Programming with ClojureJohn Stevenson
 
So you want to run a developer event, are you crazy?
So you want to run a developer event, are you crazy?So you want to run a developer event, are you crazy?
So you want to run a developer event, are you crazy?John Stevenson
 
Trailhead live - Overview of Salesforce App Cloud
Trailhead live - Overview of Salesforce App CloudTrailhead live - Overview of Salesforce App Cloud
Trailhead live - Overview of Salesforce App CloudJohn Stevenson
 
Clojure for Java developers
Clojure for Java developersClojure for Java developers
Clojure for Java developersJohn Stevenson
 
Introducing the Salesforce platform
Introducing the Salesforce platformIntroducing the Salesforce platform
Introducing the Salesforce platformJohn Stevenson
 
Dreamforce14 Metadata Management with Git Version Control
Dreamforce14 Metadata Management with Git Version ControlDreamforce14 Metadata Management with Git Version Control
Dreamforce14 Metadata Management with Git Version ControlJohn Stevenson
 
Getting started with Clojure
Getting started with ClojureGetting started with Clojure
Getting started with ClojureJohn Stevenson
 
Salesforce Summer of Hacks London - Introduction
Salesforce Summer of Hacks London - IntroductionSalesforce Summer of Hacks London - Introduction
Salesforce Summer of Hacks London - IntroductionJohn Stevenson
 
Heroku Introduction: Scaling customer facing apps & services
Heroku Introduction: Scaling customer facing apps & servicesHeroku Introduction: Scaling customer facing apps & services
Heroku Introduction: Scaling customer facing apps & servicesJohn Stevenson
 

Más de John Stevenson (20)

ClojureX Conference 2017 - 10 amazing years of Clojure
ClojureX Conference 2017 - 10 amazing years of ClojureClojureX Conference 2017 - 10 amazing years of Clojure
ClojureX Conference 2017 - 10 amazing years of Clojure
 
Confessions of a developer community builder
Confessions of a developer community builderConfessions of a developer community builder
Confessions of a developer community builder
 
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in ClojurescriptProgscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
 
Introduction to Functional Reactive Web with Clojurescript
Introduction to Functional Reactive Web with ClojurescriptIntroduction to Functional Reactive Web with Clojurescript
Introduction to Functional Reactive Web with Clojurescript
 
Thinking Functionally with Clojure
Thinking Functionally with ClojureThinking Functionally with Clojure
Thinking Functionally with Clojure
 
Communication improbable
Communication improbableCommunication improbable
Communication improbable
 
Getting into public speaking at conferences
Getting into public speaking at conferencesGetting into public speaking at conferences
Getting into public speaking at conferences
 
Functional web with clojure
Functional web with clojureFunctional web with clojure
Functional web with clojure
 
Get into Functional Programming with Clojure
Get into Functional Programming with ClojureGet into Functional Programming with Clojure
Get into Functional Programming with Clojure
 
Guiding people into Clojure
Guiding people into ClojureGuiding people into Clojure
Guiding people into Clojure
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern Developer
 
Get Functional Programming with Clojure
Get Functional Programming with ClojureGet Functional Programming with Clojure
Get Functional Programming with Clojure
 
So you want to run a developer event, are you crazy?
So you want to run a developer event, are you crazy?So you want to run a developer event, are you crazy?
So you want to run a developer event, are you crazy?
 
Trailhead live - Overview of Salesforce App Cloud
Trailhead live - Overview of Salesforce App CloudTrailhead live - Overview of Salesforce App Cloud
Trailhead live - Overview of Salesforce App Cloud
 
Clojure for Java developers
Clojure for Java developersClojure for Java developers
Clojure for Java developers
 
Introducing the Salesforce platform
Introducing the Salesforce platformIntroducing the Salesforce platform
Introducing the Salesforce platform
 
Dreamforce14 Metadata Management with Git Version Control
Dreamforce14 Metadata Management with Git Version ControlDreamforce14 Metadata Management with Git Version Control
Dreamforce14 Metadata Management with Git Version Control
 
Getting started with Clojure
Getting started with ClojureGetting started with Clojure
Getting started with Clojure
 
Salesforce Summer of Hacks London - Introduction
Salesforce Summer of Hacks London - IntroductionSalesforce Summer of Hacks London - Introduction
Salesforce Summer of Hacks London - Introduction
 
Heroku Introduction: Scaling customer facing apps & services
Heroku Introduction: Scaling customer facing apps & servicesHeroku Introduction: Scaling customer facing apps & services
Heroku Introduction: Scaling customer facing apps & services
 

Último

COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 

Último (20)

COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 

Improve your development skills with Test Driven Development

  • 1. Open Source Jumpstart: Improve your development Skills ©LeanAgileMachine Creative Commons License
  • 2. Graduate Developer Community Meet with Companies www.grad-dc.co.uk looking for interns Talk to experienced blog.grad-dc.co.uk developers & testers Ask questions about what you learnt tonight ©LeanAgileMachine Creative Commons License Socialse
  • 3. Goals of OS Jumpstart ● What tools are out there ● What should you know ● Show how Unit Testing tools support the agile process ©LeanAgileMachine Creative Commons License
  • 4. Goals of this session ● Understand the value of TDD ● Give you confidence to start learning TDD ● Tools to use to start learning ● I cant teach you TDD in one evening, sorry! ● TDD is as big as learning something like OO ● A bit of practical experience ● Pair up and try it out ● Deliberate practice ©LeanAgileMachine Creative Commons License
  • 5. Have you tried ”Test First” ? Raise your hand if you already tried TDD and ”test first” development ? ©LeanAgileMachine Creative Commons License
  • 6. Where does TDD fit ©LeanAgileMachine Creative Commons License
  • 7. So what is TDD ?? ©LeanAgileMachine Creative Commons License
  • 8. A design activity ● What is the challenge (the requirements) ● What are the concepts we are dealing with ● What is valuable ● What behaviour do I need to understand ● How do I know I have met the challenge ● How do I know I can change ©LeanAgileMachine Creative Commons License
  • 9. Understanding the problem ● Behaviour ● Concepts ● Stakeholders ● Values ● Priorities ©LeanAgileMachine Creative Commons License
  • 10. The TDD cycle ● Write a failing test so we know it tests something ● Write code to make the test pass ● Refactor code to be as simple as possible ©LeanAgileMachine Creative Commons License
  • 11. Continuous / Fast Feedback ● Are we there yet ? ● Your own ”mini-me” tester as a guide ● Only scratching the surface of testing though ©LeanAgileMachine Creative Commons License
  • 12. What tools are involved Jenkins CI ©LeanAgileMachine Creative Commons License
  • 13. Anatomy of a test ©LeanAgileMachine Creative Commons License
  • 14. Make the test compile ©LeanAgileMachine Creative Commons License
  • 16. Common assertions ● assertEquals() ● Two objects of the same type are equal in value ● assertNotNull() ● The object does not have a null value ● assertTrue() ● The statement results is a true evaluation ● assertSame() ● Two objects are the same http://junit.sourceforge.net/javadoc/org/junit/Assert.html ©LeanAgileMachine Creative Commons License
  • 17. JUnit Annotations ● @Test ● @Ignore ● Defines a method as a test ● Dont run this ● @Test(expected=exception.class) test – use ● Fails if a specific exception is no sparingly thrown ● @Test(timeout = 1000) ● Fails if test takes too long (milliseconds) http://junit.sourceforge.net/javadoc/org/junit/Test.html ©LeanAgileMachine Creative Commons License
  • 18. Test ”smells” ● Testing code rather than behaviour ● Multiple assertions ● Too specific per method ● Changing tests every ● Bloated tests time you refactor ● Harder to refactor ● Addressing to many scenarios ● Harder to understand and maintain ©LeanAgileMachine Creative Commons License
  • 19. A bad test example @Test public void equalsCheck() { System.out.println("* VectorsJUnit4Test: equalsCheck()"); assertTrue(Vectors.equal(new int[] {}, new int[] {})); assertTrue(Vectors.equal(new int[] {0}, new int[] {0})); assertTrue(Vectors.equal(new int[] {0, 0}, new int[] {0, 0})); assertTrue(Vectors.equal(new int[] {0, 0, 0}, new int[] {0, 0, 0})); assertTrue(Vectors.equal(new int[] {5, 6, 7}, new int[] {5, 6, 7})); assertFalse(Vectors.equal(new int[] {}, new int[] {0})); assertFalse(Vectors.equal(new int[] {0}, new int[] {0, 0})); assertFalse(Vectors.equal(new int[] {0, 0}, new int[] {0, 0, 0})); assertFalse(Vectors.equal(new int[] {0, 0, 0}, new int[] {0, 0})); assertFalse(Vectors.equal(new int[] {0, 0}, new int[] {0})); assertFalse(Vectors.equal(new int[] {0}, new int[] {})); assertFalse(Vectors.equal(new int[] {0, 0, 0}, new int[] {0, 0, 1})); assertFalse(Vectors.equal(new int[] {0, 0, 0}, new int[] {0, 1, 0})); assertFalse(Vectors.equal(new int[] {0, 0, 0}, new int[] {1, 0, 0})); assertFalse(Vectors.equal(new int[] {0, 0, 1}, new int[] {0, 0, 3})); } ©LeanAgileMachine Creative Commons License
  • 20. Quick Netbeans / JUnit demo - create a new project - create your first test - run the JUnit testrunner - write code to fix the test - run the JUnit testrunner - write another test... ©LeanAgileMachine Creative Commons License
  • 21. Your turn - pair up - fire up netbeans - start a new Java Application project - or check out my project - read the basic requirements - write a test... ©LeanAgileMachine Creative Commons License
  • 22. Deliberate practice ● Goal is to practice TDD ● Become comfortable with the tools ● Gain experience in writing tests ● Improve confidence in TDD ● The resulting code algorithms are not important ● I dont care how fast your calculator calculates ● You're here to learn not to produce ©LeanAgileMachine Creative Commons License
  • 23. Hamcrest asserts ● Hamcrest is a pattern matching library ● Can help make you test logic more human readable AssertThat() - instead of JUnit asserts assertThat(myCalc.addTwoNumbers(6, 7), is(6 + 7)); assertThat(myCalc.addTwoNumbers(6, 7), is(not(6 + 9))); ©LeanAgileMachine Creative Commons License
  • 24. Build Tools ● Build Automation ● Compile, test and deploy code from your repository Ant.apache.org ant.apache.org/ivy Maven.apache.org Comparison of tools: http://ant.apache.org/ivy/ m2comparison.html ©LeanAgileMachine Creative Commons License
  • 25. Integrated Development Environments ● Manage large / multiple projects ● Debugger ● Autocompletion (code api completion) ● Refactoring .org ● Build management Ant / Maven – compile, test, deploy .org ● ● Integration ● Application servers, databases, unit testing, Scm, bug tracker, CI server, IntelliJ IDEA jetbrains.org ©LeanAgileMachine Creative Commons License
  • 26. Keep the build bunny happy ● Tests help prevent build errors ● You can run your tests before you anger the build bunny ©LeanAgileMachine Creative Commons License
  • 27. Collaborative workspace ● Can show progress of your tests Confluence ● Show you which tests are failing ● Gives everyone a sence of progress ©LeanAgileMachine Creative Commons License
  • 28. Summary ● TDD is a design activity ● Gives you time to use your brain before coding ● This session was just enough to get you going ● Try doing some coding kata ● Try a coding dojo or code retreat ● LJC / GDC organising these soon ! ● Monthly Python, Clojure, Scala dojos aready running ©LeanAgileMachine Creative Commons License
  • 29. We want your feedback ©LeanAgileMachine Creative Commons License
  • 30. Graduate Developer Community www.grad-dc.co.uk Meet with Companies blog.grad-dc.co.uk looking for interns Talk to experienced developers & testers Ask questions about what you learnt tonight Socialse ©LeanAgileMachine Creative Commons License
  • 31. TDD / BDD Workshop ● Half day workshop at SkillsMatter 17 th May ● Part of London Tester Gathering days http://bit.ly/LTGDays2011 ©LeanAgileMachine Creative Commons License
  • 32. Thank you Useful links John@jr0cket.com John.Jr0cket.co.uk Toolingup.Jr0cket.co.uk Ubuntu.Jr0cket.co.uk Growing OO Software, www.grad-dc.co.uk guided by tests blog.grad-dc.co.uk ©LeanAgileMachine Creative Commons License

Notas del editor

  1. If we think about designng a museum, what does it need to do. Well we want to hold a lot of interesting pieces and we want lots of people to come along . So it needs to be a big spacious building. We need people to enter the building so we need people sized doors . We want to charge people, so we need to filter people through a payment channel. We need walls to hang things on and to keep out the cold. The building needs to be secure as there will be valuable itens that some people may want to remove, so we need some sort of security. We want to keep the items in good condition, so the internal atmosphere of the museum needs to be regularted, so we need some sort of plumbing