SlideShare a Scribd company logo
1 of 33
Download to read offline
AMIR BARYLKO
                                    TDD
                                   INTRO



                            ONLINE BUSINESS SYSTEMS
                                    APRIL 2011

Amir Barylko - OBS Apr ‘11                            MavenThought Inc.
Wednesday, April 27, 2011
WHO AM I?

    • Quality               Expert

    • Architect

    • Developer

    • Mentor

    • Great             cook

    • The           one who’s entertaining you for the next hour!
Amir Barylko - OBS Apr ‘11                                          MavenThought Inc.
Wednesday, April 27, 2011
RESOURCES

    • Email: amir@barylko.com

    • Twitter: @abarylko

    • Blog: http://www.orthocoders.com

    • Materials: http://www.orthocoders.com/presentations




Amir Barylko - OBS Apr ‘11                              MavenThought Inc.
Wednesday, April 27, 2011
TDD TRAINING

    • When: May             26 & 27

    • More             info: http://www.maventhought.com

    • Goal: Learn TDD          with real hands on examples




Amir Barylko - OBS Apr ‘11                                   MavenThought Inc.
Wednesday, April 27, 2011
INTRO
                             Why projects fail?
                              Reality Check
                             No more excuses
                               Why TDD?



Amir Barylko - OBS Apr ‘11                        MavenThought Inc.
Wednesday, April 27, 2011
WHY PROJECTS FAIL?

    • Delivering               late or over budget
    • Delivering               the wrong thing
    • Unstable                in production
    • Costly                to maintain


Amir Barylko - OBS Apr ‘11                           MavenThought Inc.
Wednesday, April 27, 2011
REALITY CHECK

    • It  is impossible to gather all the requirements at
        the beginning of a project.
    • Whatever    requirements you do gather are
        guaranteed to change.
    • There  will always be more to do than time and
        money will allow.

Amir Barylko - OBS Apr ‘11                        MavenThought Inc.
Wednesday, April 27, 2011
NO MORE EXCUSES

    • It     works on my computer!   • We need a satellite
                                      connection in order to
    • It  was like that when I got    run it!
        here!
                                     • We can’t reproduce the
    • The    previous developer       error!
        didn’t know XXXX!
                                     • We   can’t test that!


Amir Barylko - OBS Apr ‘11                                MavenThought Inc.
Wednesday, April 27, 2011
WHY TDD?

    • Prove                 that your code     • Regression   tests as
        works                                   byproduct
    • Avoid   waste                            • Makechanges with
        (debugging)                             confidence
    • Increment                 code quality   • Bring
                                                     back the joy of
                                                coding!
    • Better                design
Amir Barylko - OBS Apr ‘11                                       MavenThought Inc.
Wednesday, April 27, 2011
APPLYING TDD
                                  Iteration 0 .. N
                                Quality as a Driver
                              Red - Green - Refactor




Amir Barylko - OBS Apr ‘11                             MavenThought Inc.
Wednesday, April 27, 2011
ITERATION 0

    • Flush           out architecture.

    • Setup Testing            harness for TDD and BDD.

    • Setup             continuous integration.

    • Setup             scripts to build, deploy, etc.

    • Setup             visual communication tools.


Amir Barylko - OBS Apr ‘11                                MavenThought Inc.
Wednesday, April 27, 2011
ITERATION 1.. N
    • Start           by Story Planning

         • Pair         programming (switching often)   Every day!

         • Daily            Scrum

    • End          with Retrospective




Amir Barylko - OBS Apr ‘11                                      MavenThought Inc.
Wednesday, April 27, 2011
QUALITY AS A DRIVER
                                           Red
                                           BDD

                                           Red




        Refactor                Refactor   TDD   Green   Green




Amir Barylko - OBS Apr ‘11                                 MavenThought Inc.
Wednesday, April 27, 2011
RED

    •Write                  a test that fails
    •Relax, is                ok if it compiles




Amir Barylko - OBS Apr ‘11                        MavenThought Inc.
Wednesday, April 27, 2011
GREEN

    • Try            to make the test pass
    • Do             a simple solution
    • Use              default values (not throwing exceptions)
    • Don’t                 worry if the code “smells”


Amir Barylko - OBS Apr ‘11                                 MavenThought Inc.
Wednesday, April 27, 2011
REFACTOR

    • Avoid                 repeating code
    • Avoid                 hardcoding dependencies
    • Avoid “write                only” code
    • Refactor                with confidence!
    • Run              all tests if possible
Amir Barylko - OBS Apr ‘11                            MavenThought Inc.
Wednesday, April 27, 2011
DEMO
                             Unit Testing Frameworks
                              Given - When - Then
                                 Listing Contents
                                      Reviews



Amir Barylko - OBS Apr ‘11                             MavenThought Inc.
Wednesday, April 27, 2011
TESTING FRAMEWORKS

    • MsTest, xUnit, nUnit, MbUnit, MSpec

    • Similar “hooks”

         • Before           and after test

         • Before           and after all test

         • Arrange, Act, Assert



Amir Barylko - OBS Apr ‘11                       MavenThought Inc.
Wednesday, April 27, 2011
GIVEN WHEN THEN

    • Test          one “scenario” at a time

    • Clear            identification of functionality

    • Easy           to write, understand and maintain

    • Repeatable, easy            to learn	





Amir Barylko - OBS Apr ‘11                               MavenThought Inc.
Wednesday, April 27, 2011
LISTING CONTENTS

    • Controller “Movies” method “Index”

    • Two            scenarios

         • Given            I have no movies....

         • Given            I have the following movies....

    • Where                 do I get the movies from?


Amir Barylko - OBS Apr ‘11                                    MavenThought Inc.
Wednesday, April 27, 2011
GIVEN I HAVE NO MOVIES
    [It]
    public void Should_not_return_any_movies()
    {
         var result = (ViewResult)this.ActualResult;

             var actual = (IEnumerable<IMovie>) result.ViewData.Model;

             actual.Should().Be.Empty();
    }

    [It]
    public void Should_render_the_index_view()
    {
         this.ActualResult.AssertViewRendered();
    }


Amir Barylko - OBS Apr ‘11                                               MavenThought Inc.
Wednesday, April 27, 2011
GIVEN I HAVE 10 MOVIES
    [It]
    public void Should_return_all_the_movies()
    {
         var result = (ViewResult)this.ActualResult;

              var actual = (IEnumerable<IMovie>) result.ViewData.Model;

              actual.Should().Have.SameValuesAs(this._movies);
    }




Amir Barylko - OBS Apr ‘11                                        MavenThought Inc.
Wednesday, April 27, 2011
ARE WE DONE?

    • Fail            1: IMovieLibrary is not registered in the container

    • Fail            2: SimpleMovieLibrary needs the db name

    • How             can we make sure it works?

    • Is TDD                enough?




Amir Barylko - OBS Apr ‘11                                            MavenThought Inc.
Wednesday, April 27, 2011
FIX THE CONTAINER

    Component
      .For<IMovieLibrary>()
      .Instance(new SimpleMovieLibrary(dbFile))...




Amir Barylko - OBS Apr ‘11                      MavenThought Inc.
Wednesday, April 27, 2011
SAFETY NET
    Scenario: Browse available movies
         Given I have the following movies:
              | title             |
              | Blazing Saddles |
              | Space Balls       |
         When I go to "Movies"
         Then I should see in the listing:
              | title                 |
              | Blazing Saddles       |
              | Space Balls           |




Amir Barylko - OBS Apr ‘11                    MavenThought Inc.
Wednesday, April 27, 2011
SUMMARY
                               Benefits
                              Challenges
                              Adoption




Amir Barylko - OBS Apr ‘11                 MavenThought Inc.
Wednesday, April 27, 2011
BENEFITS

    • Let           the methodology drive
    • It      will save your bacon!
    • High                  quality the whole way!
    • Very                  few bugs!
    • Do             your duty as developer!
Amir Barylko - OBS Apr ‘11                           MavenThought Inc.
Wednesday, April 27, 2011
CHALLENGES

    • Very             different from conventional testing
    • Many                  developers find it complex to learn at first
    • Hard              to start without a Mentor
    • Management                   buy in
    • Difficult                to keep under deadline pressure
    • Beware                  of code coverage!
Amir Barylko - OBS Apr ‘11                                           MavenThought Inc.
Wednesday, April 27, 2011
ADOPTION

    • Find           Mentor/Couch/Trainer
    • Small             iterations
    • Have              metrics ready (velocity, etc)
    • Do           whatever works for you
    • Find           out which tools will benefit you
    • Automate,                  automate, automate!
Amir Barylko - OBS Apr ‘11                              MavenThought Inc.
Wednesday, April 27, 2011
QUESTIONS?




Amir Barylko - .NET UG Mar ‘11                MavenThought Inc.
Wednesday, April 27, 2011
RESOURCES

    • Email: amir@barylko.com

    • Twitter: @abarylko

    • Slides: http://www.orthocoders.com/presentations




Amir Barylko - OBS Apr ‘11                               MavenThought Inc.
Wednesday, April 27, 2011
RESOURCES II




Amir Barylko - OBS Apr ‘11                  MavenThought Inc.
Wednesday, April 27, 2011
TDD TRAINING

    • When: May             26 & 27

    • More             info: http://www.maventhought.com

    • Goal: Learn TDD          with real hands on examples




Amir Barylko - OBS Apr ‘11                                   MavenThought Inc.
Wednesday, April 27, 2011

More Related Content

Viewers also liked

TDD Boot Camp Sapporo 1.5
TDD Boot Camp Sapporo 1.5 TDD Boot Camp Sapporo 1.5
TDD Boot Camp Sapporo 1.5 Shuji Watanabe
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentConsulthinkspa
 
VT.NET 20160411: An Intro to Test Driven Development (TDD)
VT.NET 20160411: An Intro to Test Driven Development (TDD)VT.NET 20160411: An Intro to Test Driven Development (TDD)
VT.NET 20160411: An Intro to Test Driven Development (TDD)Rob Hale
 
Elm: delightful web development
Elm: delightful web developmentElm: delightful web development
Elm: delightful web developmentAmir Barylko
 
TDD for the Newb Who Wants to Become an Apprentice
TDD for the Newb Who Wants to Become an ApprenticeTDD for the Newb Who Wants to Become an Apprentice
TDD for the Newb Who Wants to Become an ApprenticeHoward Deiner
 
Pitfalls Of Tdd Adoption by Bartosz Bankowski
Pitfalls Of Tdd Adoption by Bartosz BankowskiPitfalls Of Tdd Adoption by Bartosz Bankowski
Pitfalls Of Tdd Adoption by Bartosz BankowskiAgileee
 
User stories deep dive
User stories deep diveUser stories deep dive
User stories deep diveAmir Barylko
 

Viewers also liked (9)

TDD Boot Camp Sapporo 1.5
TDD Boot Camp Sapporo 1.5 TDD Boot Camp Sapporo 1.5
TDD Boot Camp Sapporo 1.5
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
VT.NET 20160411: An Intro to Test Driven Development (TDD)
VT.NET 20160411: An Intro to Test Driven Development (TDD)VT.NET 20160411: An Intro to Test Driven Development (TDD)
VT.NET 20160411: An Intro to Test Driven Development (TDD)
 
Elm: delightful web development
Elm: delightful web developmentElm: delightful web development
Elm: delightful web development
 
TDD for the Newb Who Wants to Become an Apprentice
TDD for the Newb Who Wants to Become an ApprenticeTDD for the Newb Who Wants to Become an Apprentice
TDD for the Newb Who Wants to Become an Apprentice
 
Pitfalls Of Tdd Adoption by Bartosz Bankowski
Pitfalls Of Tdd Adoption by Bartosz BankowskiPitfalls Of Tdd Adoption by Bartosz Bankowski
Pitfalls Of Tdd Adoption by Bartosz Bankowski
 
No estimates
No estimatesNo estimates
No estimates
 
User stories deep dive
User stories deep diveUser stories deep dive
User stories deep dive
 
Dot Net Core
Dot Net CoreDot Net Core
Dot Net Core
 

Similar to obs-tdd-intro

Codemash-iron-ruby-match-made-in-heaven
Codemash-iron-ruby-match-made-in-heavenCodemash-iron-ruby-match-made-in-heaven
Codemash-iron-ruby-match-made-in-heavenAmir Barylko
 
Quality web-acceptance
Quality web-acceptanceQuality web-acceptance
Quality web-acceptanceAmir Barylko
 
Is Advanced Verification for FPGA based Logic needed
Is Advanced Verification for FPGA based Logic neededIs Advanced Verification for FPGA based Logic needed
Is Advanced Verification for FPGA based Logic neededchiportal
 
High quality iOS development
High quality iOS developmentHigh quality iOS development
High quality iOS developmentRobin Lu
 
Atlassian RoadTrip 2011 Slide Deck
Atlassian RoadTrip 2011 Slide DeckAtlassian RoadTrip 2011 Slide Deck
Atlassian RoadTrip 2011 Slide DeckAtlassian
 
Continuous Deployment at Disqus (Pylons Minicon)
Continuous Deployment at Disqus (Pylons Minicon)Continuous Deployment at Disqus (Pylons Minicon)
Continuous Deployment at Disqus (Pylons Minicon)zeeg
 
Mozilla: Continuous Deploment on SUMO
Mozilla: Continuous Deploment on SUMOMozilla: Continuous Deploment on SUMO
Mozilla: Continuous Deploment on SUMOMatt Brandt
 
MDW Boulder April '11 | Tim Malbon_How to actually make something
MDW Boulder April '11 | Tim Malbon_How to actually make somethingMDW Boulder April '11 | Tim Malbon_How to actually make something
MDW Boulder April '11 | Tim Malbon_How to actually make somethingBoulder Digital Works at CU
 
David Mytton, Boxed Ice
David Mytton, Boxed Ice   David Mytton, Boxed Ice
David Mytton, Boxed Ice Mashery
 
PRDC11-Jruby-ironruby
PRDC11-Jruby-ironrubyPRDC11-Jruby-ironruby
PRDC11-Jruby-ironrubyAmir Barylko
 
Bonfire... How'd You Do That?! - AtlasCamp 2011
Bonfire... How'd You Do That?! - AtlasCamp 2011Bonfire... How'd You Do That?! - AtlasCamp 2011
Bonfire... How'd You Do That?! - AtlasCamp 2011Atlassian
 
Puppet camp europe 2011 hackability
Puppet camp europe 2011   hackabilityPuppet camp europe 2011   hackability
Puppet camp europe 2011 hackabilityPuppet
 
Clouds against the Floods (RubyConfBR2011)
Clouds against the Floods (RubyConfBR2011) Clouds against the Floods (RubyConfBR2011)
Clouds against the Floods (RubyConfBR2011) Leonardo Borges
 
ExpOn 2011 - Diego Monteiro - Níveis de Maturidade nas Mídias Sociais
ExpOn 2011 - Diego Monteiro - Níveis de Maturidade nas Mídias SociaisExpOn 2011 - Diego Monteiro - Níveis de Maturidade nas Mídias Sociais
ExpOn 2011 - Diego Monteiro - Níveis de Maturidade nas Mídias SociaisDOGSCAMP Summit
 
Journey to 1000 tests a day
Journey to 1000 tests a dayJourney to 1000 tests a day
Journey to 1000 tests a dayBruce McLeod
 
Devopsdays Goteborg 2011 - State of the Union
Devopsdays Goteborg 2011 - State of the UnionDevopsdays Goteborg 2011 - State of the Union
Devopsdays Goteborg 2011 - State of the UnionJohn Willis
 

Similar to obs-tdd-intro (20)

agile-planning
agile-planningagile-planning
agile-planning
 
Codemash-iron-ruby-match-made-in-heaven
Codemash-iron-ruby-match-made-in-heavenCodemash-iron-ruby-match-made-in-heaven
Codemash-iron-ruby-match-made-in-heaven
 
Quality web-acceptance
Quality web-acceptanceQuality web-acceptance
Quality web-acceptance
 
Iterations-zero-n
Iterations-zero-nIterations-zero-n
Iterations-zero-n
 
Is Advanced Verification for FPGA based Logic needed
Is Advanced Verification for FPGA based Logic neededIs Advanced Verification for FPGA based Logic needed
Is Advanced Verification for FPGA based Logic needed
 
High quality iOS development
High quality iOS developmentHigh quality iOS development
High quality iOS development
 
Atlassian RoadTrip 2011 Slide Deck
Atlassian RoadTrip 2011 Slide DeckAtlassian RoadTrip 2011 Slide Deck
Atlassian RoadTrip 2011 Slide Deck
 
Continuous Deployment at Disqus (Pylons Minicon)
Continuous Deployment at Disqus (Pylons Minicon)Continuous Deployment at Disqus (Pylons Minicon)
Continuous Deployment at Disqus (Pylons Minicon)
 
Mozilla: Continuous Deploment on SUMO
Mozilla: Continuous Deploment on SUMOMozilla: Continuous Deploment on SUMO
Mozilla: Continuous Deploment on SUMO
 
MDW Boulder April '11 | Tim Malbon_How to actually make something
MDW Boulder April '11 | Tim Malbon_How to actually make somethingMDW Boulder April '11 | Tim Malbon_How to actually make something
MDW Boulder April '11 | Tim Malbon_How to actually make something
 
Godoggo
GodoggoGodoggo
Godoggo
 
David Mytton, Boxed Ice
David Mytton, Boxed Ice   David Mytton, Boxed Ice
David Mytton, Boxed Ice
 
why-tdd
why-tddwhy-tdd
why-tdd
 
PRDC11-Jruby-ironruby
PRDC11-Jruby-ironrubyPRDC11-Jruby-ironruby
PRDC11-Jruby-ironruby
 
Bonfire... How'd You Do That?! - AtlasCamp 2011
Bonfire... How'd You Do That?! - AtlasCamp 2011Bonfire... How'd You Do That?! - AtlasCamp 2011
Bonfire... How'd You Do That?! - AtlasCamp 2011
 
Puppet camp europe 2011 hackability
Puppet camp europe 2011   hackabilityPuppet camp europe 2011   hackability
Puppet camp europe 2011 hackability
 
Clouds against the Floods (RubyConfBR2011)
Clouds against the Floods (RubyConfBR2011) Clouds against the Floods (RubyConfBR2011)
Clouds against the Floods (RubyConfBR2011)
 
ExpOn 2011 - Diego Monteiro - Níveis de Maturidade nas Mídias Sociais
ExpOn 2011 - Diego Monteiro - Níveis de Maturidade nas Mídias SociaisExpOn 2011 - Diego Monteiro - Níveis de Maturidade nas Mídias Sociais
ExpOn 2011 - Diego Monteiro - Níveis de Maturidade nas Mídias Sociais
 
Journey to 1000 tests a day
Journey to 1000 tests a dayJourney to 1000 tests a day
Journey to 1000 tests a day
 
Devopsdays Goteborg 2011 - State of the Union
Devopsdays Goteborg 2011 - State of the UnionDevopsdays Goteborg 2011 - State of the Union
Devopsdays Goteborg 2011 - State of the Union
 

More from Amir Barylko

Functional converter project
Functional converter projectFunctional converter project
Functional converter projectAmir Barylko
 
Coderetreat hosting training
Coderetreat hosting trainingCoderetreat hosting training
Coderetreat hosting trainingAmir Barylko
 
There's no charge for (functional) awesomeness
There's no charge for (functional) awesomenessThere's no charge for (functional) awesomeness
There's no charge for (functional) awesomenessAmir Barylko
 
What's new in c# 6
What's new in c# 6What's new in c# 6
What's new in c# 6Amir Barylko
 
Who killed object oriented design?
Who killed object oriented design?Who killed object oriented design?
Who killed object oriented design?Amir Barylko
 
From coach to owner - What I learned from the other side
From coach to owner - What I learned from the other sideFrom coach to owner - What I learned from the other side
From coach to owner - What I learned from the other sideAmir Barylko
 
Communication is the Key to Teamwork and productivity
Communication is the Key to Teamwork and productivityCommunication is the Key to Teamwork and productivity
Communication is the Key to Teamwork and productivityAmir Barylko
 
Acceptance Test Driven Development
Acceptance Test Driven DevelopmentAcceptance Test Driven Development
Acceptance Test Driven DevelopmentAmir Barylko
 
Agile requirements
Agile requirementsAgile requirements
Agile requirementsAmir Barylko
 
Agile teams and responsibilities
Agile teams and responsibilitiesAgile teams and responsibilities
Agile teams and responsibilitiesAmir Barylko
 
Beutiful javascript with coffeescript
Beutiful javascript with coffeescriptBeutiful javascript with coffeescript
Beutiful javascript with coffeescriptAmir Barylko
 
Rich UI with Knockout.js &amp; Coffeescript
Rich UI with Knockout.js &amp; CoffeescriptRich UI with Knockout.js &amp; Coffeescript
Rich UI with Knockout.js &amp; CoffeescriptAmir Barylko
 
Agile requirements
Agile requirementsAgile requirements
Agile requirementsAmir Barylko
 
SDEC12 Beautiful javascript with coffeescript
SDEC12 Beautiful javascript with coffeescriptSDEC12 Beautiful javascript with coffeescript
SDEC12 Beautiful javascript with coffeescriptAmir Barylko
 
Beutiful javascript with coffeescript
Beutiful javascript with coffeescriptBeutiful javascript with coffeescript
Beutiful javascript with coffeescriptAmir Barylko
 
Cpl12 continuous integration
Cpl12 continuous integrationCpl12 continuous integration
Cpl12 continuous integrationAmir Barylko
 

More from Amir Barylko (20)

Functional converter project
Functional converter projectFunctional converter project
Functional converter project
 
Coderetreat hosting training
Coderetreat hosting trainingCoderetreat hosting training
Coderetreat hosting training
 
There's no charge for (functional) awesomeness
There's no charge for (functional) awesomenessThere's no charge for (functional) awesomeness
There's no charge for (functional) awesomeness
 
What's new in c# 6
What's new in c# 6What's new in c# 6
What's new in c# 6
 
Productive teams
Productive teamsProductive teams
Productive teams
 
Who killed object oriented design?
Who killed object oriented design?Who killed object oriented design?
Who killed object oriented design?
 
From coach to owner - What I learned from the other side
From coach to owner - What I learned from the other sideFrom coach to owner - What I learned from the other side
From coach to owner - What I learned from the other side
 
Communication is the Key to Teamwork and productivity
Communication is the Key to Teamwork and productivityCommunication is the Key to Teamwork and productivity
Communication is the Key to Teamwork and productivity
 
Acceptance Test Driven Development
Acceptance Test Driven DevelopmentAcceptance Test Driven Development
Acceptance Test Driven Development
 
Refactoring
RefactoringRefactoring
Refactoring
 
Agile requirements
Agile requirementsAgile requirements
Agile requirements
 
Agile teams and responsibilities
Agile teams and responsibilitiesAgile teams and responsibilities
Agile teams and responsibilities
 
Refactoring
RefactoringRefactoring
Refactoring
 
Beutiful javascript with coffeescript
Beutiful javascript with coffeescriptBeutiful javascript with coffeescript
Beutiful javascript with coffeescript
 
Sass & bootstrap
Sass & bootstrapSass & bootstrap
Sass & bootstrap
 
Rich UI with Knockout.js &amp; Coffeescript
Rich UI with Knockout.js &amp; CoffeescriptRich UI with Knockout.js &amp; Coffeescript
Rich UI with Knockout.js &amp; Coffeescript
 
Agile requirements
Agile requirementsAgile requirements
Agile requirements
 
SDEC12 Beautiful javascript with coffeescript
SDEC12 Beautiful javascript with coffeescriptSDEC12 Beautiful javascript with coffeescript
SDEC12 Beautiful javascript with coffeescript
 
Beutiful javascript with coffeescript
Beutiful javascript with coffeescriptBeutiful javascript with coffeescript
Beutiful javascript with coffeescript
 
Cpl12 continuous integration
Cpl12 continuous integrationCpl12 continuous integration
Cpl12 continuous integration
 

Recently uploaded

Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 

Recently uploaded (20)

Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 

obs-tdd-intro

  • 1. AMIR BARYLKO TDD INTRO ONLINE BUSINESS SYSTEMS APRIL 2011 Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 2. WHO AM I? • Quality Expert • Architect • Developer • Mentor • Great cook • The one who’s entertaining you for the next hour! Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 3. RESOURCES • Email: amir@barylko.com • Twitter: @abarylko • Blog: http://www.orthocoders.com • Materials: http://www.orthocoders.com/presentations Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 4. TDD TRAINING • When: May 26 & 27 • More info: http://www.maventhought.com • Goal: Learn TDD with real hands on examples Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 5. INTRO Why projects fail? Reality Check No more excuses Why TDD? Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 6. WHY PROJECTS FAIL? • Delivering late or over budget • Delivering the wrong thing • Unstable in production • Costly to maintain Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 7. REALITY CHECK • It is impossible to gather all the requirements at the beginning of a project. • Whatever requirements you do gather are guaranteed to change. • There will always be more to do than time and money will allow. Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 8. NO MORE EXCUSES • It works on my computer! • We need a satellite connection in order to • It was like that when I got run it! here! • We can’t reproduce the • The previous developer error! didn’t know XXXX! • We can’t test that! Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 9. WHY TDD? • Prove that your code • Regression tests as works byproduct • Avoid waste • Makechanges with (debugging) confidence • Increment code quality • Bring back the joy of coding! • Better design Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 10. APPLYING TDD Iteration 0 .. N Quality as a Driver Red - Green - Refactor Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 11. ITERATION 0 • Flush out architecture. • Setup Testing harness for TDD and BDD. • Setup continuous integration. • Setup scripts to build, deploy, etc. • Setup visual communication tools. Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 12. ITERATION 1.. N • Start by Story Planning • Pair programming (switching often) Every day! • Daily Scrum • End with Retrospective Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 13. QUALITY AS A DRIVER Red BDD Red Refactor Refactor TDD Green Green Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 14. RED •Write a test that fails •Relax, is ok if it compiles Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 15. GREEN • Try to make the test pass • Do a simple solution • Use default values (not throwing exceptions) • Don’t worry if the code “smells” Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 16. REFACTOR • Avoid repeating code • Avoid hardcoding dependencies • Avoid “write only” code • Refactor with confidence! • Run all tests if possible Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 17. DEMO Unit Testing Frameworks Given - When - Then Listing Contents Reviews Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 18. TESTING FRAMEWORKS • MsTest, xUnit, nUnit, MbUnit, MSpec • Similar “hooks” • Before and after test • Before and after all test • Arrange, Act, Assert Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 19. GIVEN WHEN THEN • Test one “scenario” at a time • Clear identification of functionality • Easy to write, understand and maintain • Repeatable, easy to learn Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 20. LISTING CONTENTS • Controller “Movies” method “Index” • Two scenarios • Given I have no movies.... • Given I have the following movies.... • Where do I get the movies from? Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 21. GIVEN I HAVE NO MOVIES [It] public void Should_not_return_any_movies() { var result = (ViewResult)this.ActualResult; var actual = (IEnumerable<IMovie>) result.ViewData.Model; actual.Should().Be.Empty(); } [It] public void Should_render_the_index_view() { this.ActualResult.AssertViewRendered(); } Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 22. GIVEN I HAVE 10 MOVIES [It] public void Should_return_all_the_movies() { var result = (ViewResult)this.ActualResult; var actual = (IEnumerable<IMovie>) result.ViewData.Model; actual.Should().Have.SameValuesAs(this._movies); } Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 23. ARE WE DONE? • Fail 1: IMovieLibrary is not registered in the container • Fail 2: SimpleMovieLibrary needs the db name • How can we make sure it works? • Is TDD enough? Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 24. FIX THE CONTAINER Component .For<IMovieLibrary>() .Instance(new SimpleMovieLibrary(dbFile))... Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 25. SAFETY NET Scenario: Browse available movies Given I have the following movies: | title | | Blazing Saddles | | Space Balls | When I go to "Movies" Then I should see in the listing: | title | | Blazing Saddles | | Space Balls | Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 26. SUMMARY Benefits Challenges Adoption Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 27. BENEFITS • Let the methodology drive • It will save your bacon! • High quality the whole way! • Very few bugs! • Do your duty as developer! Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 28. CHALLENGES • Very different from conventional testing • Many developers find it complex to learn at first • Hard to start without a Mentor • Management buy in • Difficult to keep under deadline pressure • Beware of code coverage! Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 29. ADOPTION • Find Mentor/Couch/Trainer • Small iterations • Have metrics ready (velocity, etc) • Do whatever works for you • Find out which tools will benefit you • Automate, automate, automate! Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 30. QUESTIONS? Amir Barylko - .NET UG Mar ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 31. RESOURCES • Email: amir@barylko.com • Twitter: @abarylko • Slides: http://www.orthocoders.com/presentations Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 32. RESOURCES II Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011
  • 33. TDD TRAINING • When: May 26 & 27 • More info: http://www.maventhought.com • Goal: Learn TDD with real hands on examples Amir Barylko - OBS Apr ‘11 MavenThought Inc. Wednesday, April 27, 2011