SlideShare a Scribd company logo
TEST DRIVEN DEVELOPMENT
                      Auckland WebDev Nights Meetup - 26th April 2012




Sunday, 29 April 12
Who are you?
                      Hi, I’m Caleb Tutty - [that’s Tuh-tee]

                      Ruby on Rails developer working at onebigvoice

                      twitter: @Caleb_T

                      email: caleb@prettymint.co.nz

                      github: https://github.com/tuttinator


                      Feel free to pipe up with questions at any point, but there will be time at the end too.



Sunday, 29 April 12
What do I mean by testing?
                      Automated testing. Tests written by developers to check the
                      functionality of their application behaves as they expect it to.
                      (Assertions). These tests are run by a test suite.

                      Test broadly fall into two groups - unit tests and integration tests

                      Unit tests look at isolated parts of functionality, and ensuring
                      that each part does what you thought it should. (e.g.
                      Controllers and Models)

                      Integration tests are higher level - and aimed at the integrated
                      user experience. These test that everything plays nicely with
                      each other (e.g. the View layer interacting with Controllers
                      and models)


Sunday, 29 April 12
Cool, got it.
                      ...so when should I test?




Sunday, 29 April 12
Cool, got it.
                          ...so when should I test?

                      Not in production!

                      Before you merge into the master branch of your
                      source control

                      Actually, TATFT




Sunday, 29 April 12
TAFT?

                      Test all the f@#&ing time.*

                      Bryan Liles - http://www.confreaks.com/videos/496-
                      rubyhoedown2008-lightning-talk-tatft-test-all-the-f-in-time

                      * Remember this as a qualification for later:

                              “Quidquid latine dictum sit, altum sonatur.”



Sunday, 29 April 12
Really, all the time? Why?
                      Tests give you notifications when a change
                      breaks part of your app

                      Tests tell you where to look

                      Tests document your application

                      Tests help you work in teams

                      Tests mean that you can come back to a feature
                      later and remind you what the hell you were
                      doing

Sunday, 29 April 12
ENOUGH TALKING, NOW
            SHOW ME SOMETHING COOL



Sunday, 29 April 12
“Quidquid latine dictum sit,
                           altum sonatur.”
                       Anything in Latin sounds
                             profound...




Sunday, 29 April 12
Too much testing?

                      “I get paid for code that works, not for tests, so my philosophy is to test
                      as little as possible to reach a given level of confidence (I suspect this
                      level of confidence is high compared to industry standards, but that
                      could just be hubris). If I don’t typically make a kind of mistake (like
                      setting the wrong variables in a constructor), I don’t test for it. I do tend
                      to make sense of test errors, so I’m extra careful when I have logic with
                      complicated conditionals. When coding on a team, I modify my
                      strategy to carefully test code that we, collectively, tend to get
                      wrong.” - Kent Bent, of Test First development fame

                               source: http://stackoverflow.com/questions/153234/how-deep-are-your-unit-tests/
                                                                                             153565#153565




Sunday, 29 April 12
Too much testing?

                      “When developers first discover the wonders of
                      test-driven development, it’s like gaining entrance
                      to a new and better world with less stress and
                      insecurity. It truly is a wonderful experience well
                      worth celebrating. But internalizing the benefits of
                      testing is only the first step to enlightenment.
                      Knowing what not to test is the harder part of the
                      lesson.” - DHH (creator of Rails)
                                        source: http://37signals.com/svn/posts/3159-testing-like-the-tsa




Sunday, 29 April 12
but testing is only for Rails
                                    devs, amirite?
                      Nope!
                      PHP
                      https://github.com/sebastianbergmann/phpunit/

                      http://symfony.com/doc/current/book/testing.html


                      Python
                      http://pytest.org/latest/


                      Node.js and JavaScript
                      http://pivotal.github.com/jasmine/

                      http://elegantcode.com/2011/03/07/taking-baby-steps-with-node-js-bdd-style-unit-tests-with-jasmine-node-sprinkled-with-some-should/


                      AS3 - I know there’s a Flex Dev in the audience
                      http://asunit.org/


                      .NET - Visual Studio has unit testing since VS 2005 -
                      http://msdn.microsoft.com/en-us/library/ms243147.aspx (well.. except for the free Express versions - http://greenicicleblog.com/2010/04/13/visual-studio-2010-express-no-
                      tests-please/ and http://www.hexsaw.org.uk/2011/01/13/once-more-on-tdd-and-microsoft-visual-studio-2010-express-edition/ )

                      “I’m not one who says everything should be free. Microsoft do not claim to offer a free full-blown development environment; that’s OK. But from all things that you can
                      leave out: why does it have to be the all abilities to run unit tests? That seems like a strange signal towards the importance of quality.”




Sunday, 29 April 12
is there moar?

                      Beyond the scope of this talk:

                      Factories versus Fixtures

                      Cucumber and BDD

                      JavaScript testing

                      Spork and Continuous Integration Servers



Sunday, 29 April 12
QUESTIONS?




Sunday, 29 April 12

More Related Content

PDF
An Introduction to Test Driven Development
PPTX
Obejct Oriented SCM - OOSCM
PDF
TAP-Harness + friends
PDF
Test Driven Development (TDD)
PDF
Dependency Injection in iOS
PPTX
Test-Driven Development
PDF
Agile Programming Systems # TDD intro
PDF
Unit Test + Functional Programming = Love
An Introduction to Test Driven Development
Obejct Oriented SCM - OOSCM
TAP-Harness + friends
Test Driven Development (TDD)
Dependency Injection in iOS
Test-Driven Development
Agile Programming Systems # TDD intro
Unit Test + Functional Programming = Love

Viewers also liked (20)

PDF
Speed up Rails Responses
PDF
Βιολογία Α Γυμνασίου Ερωτήσεις-Απαντήσεις-Ασκήσεις με Λύσεις του Βιβλίου
PPTX
Η μέλισσα, ένα ασπόνδυλο ζώο / Σπονδυλωτά και ασπόνδυλα ζώα - 3η Ενότητα: Κεφ...
PPS
Herramientas Informáticas que se pueden utilizar en el área de Psicología
PDF
CICLASUR 2016 - TEMA 1 - "Teresa de Los Andes Enamorada de Jesucristo"
PDF
Estrategiaslingestudio2012
PDF
La esencia de los equipos auto-gestionados y el Líder Jardinero
PDF
Revista Ayudeporte Nº 4
PPTX
PDF
Rentabiliza Clientes
PPTX
Dpw retiree celebration picture slide format
PDF
24234
PDF
Using Video to Drive Sales by Richter10.2 Media Group - www.r102video.com
PDF
Avances en swh ignacio malaga
PDF
Fibra residual, una alternativa de mitigacion para la contaminacion ambiental
PPT
Make Google AdWords More Effective
PPTX
Desmontaje de la computadora
PDF
Broschüre Agentur Leven
PDF
Brochure & Order Form_Middle East Internet & B2C E-Commerce Report 2012_by yS...
Speed up Rails Responses
Βιολογία Α Γυμνασίου Ερωτήσεις-Απαντήσεις-Ασκήσεις με Λύσεις του Βιβλίου
Η μέλισσα, ένα ασπόνδυλο ζώο / Σπονδυλωτά και ασπόνδυλα ζώα - 3η Ενότητα: Κεφ...
Herramientas Informáticas que se pueden utilizar en el área de Psicología
CICLASUR 2016 - TEMA 1 - "Teresa de Los Andes Enamorada de Jesucristo"
Estrategiaslingestudio2012
La esencia de los equipos auto-gestionados y el Líder Jardinero
Revista Ayudeporte Nº 4
Rentabiliza Clientes
Dpw retiree celebration picture slide format
24234
Using Video to Drive Sales by Richter10.2 Media Group - www.r102video.com
Avances en swh ignacio malaga
Fibra residual, una alternativa de mitigacion para la contaminacion ambiental
Make Google AdWords More Effective
Desmontaje de la computadora
Broschüre Agentur Leven
Brochure & Order Form_Middle East Internet & B2C E-Commerce Report 2012_by yS...
Ad

Similar to Test Driven Development - Caleb Tutty (20)

PDF
Developer disciplines
PPT
Unit Testing, TDD and the Walking Skeleton
ODP
Debugging
PPTX
DevOps - Boldly Go for Distro
PDF
Testing practicies not only in scala
PDF
Testing and TDD - KoJUG
PDF
SELJE_Database_Unit_Testing_Slides.pdf
PPTX
DevOps
ODP
I Smell A RAT- Rapid Application Testing
PPTX
An Introduction to unit testing
PPTX
Unit Testing and TDD 2017
PDF
Plone Testing Tools And Techniques
PPTX
Agile test practices
PDF
Test Drive Development
PDF
5-Ways-to-Revolutionize-Your-Software-Testing
PPTX
Software testing 2012 - A Year in Review
PPTX
2016 10-04: tdd++: tdd made easier
PDF
PL/SQL unit testing with Ruby
PPTX
An Agilist's Guide to Excelling on a Scrum Team as a Tester
PPTX
Get the Balance Right: Acceptance Test Driven Development, GUI Automation and...
Developer disciplines
Unit Testing, TDD and the Walking Skeleton
Debugging
DevOps - Boldly Go for Distro
Testing practicies not only in scala
Testing and TDD - KoJUG
SELJE_Database_Unit_Testing_Slides.pdf
DevOps
I Smell A RAT- Rapid Application Testing
An Introduction to unit testing
Unit Testing and TDD 2017
Plone Testing Tools And Techniques
Agile test practices
Test Drive Development
5-Ways-to-Revolutionize-Your-Software-Testing
Software testing 2012 - A Year in Review
2016 10-04: tdd++: tdd made easier
PL/SQL unit testing with Ruby
An Agilist's Guide to Excelling on a Scrum Team as a Tester
Get the Balance Right: Acceptance Test Driven Development, GUI Automation and...
Ad

Recently uploaded (20)

PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Modernizing your data center with Dell and AMD
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
A Presentation on Artificial Intelligence
PDF
Electronic commerce courselecture one. Pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
KodekX | Application Modernization Development
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPT
Teaching material agriculture food technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
Digital-Transformation-Roadmap-for-Companies.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
MYSQL Presentation for SQL database connectivity
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
“AI and Expert System Decision Support & Business Intelligence Systems”
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Modernizing your data center with Dell and AMD
The AUB Centre for AI in Media Proposal.docx
Review of recent advances in non-invasive hemoglobin estimation
Encapsulation_ Review paper, used for researhc scholars
A Presentation on Artificial Intelligence
Electronic commerce courselecture one. Pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Chapter 3 Spatial Domain Image Processing.pdf
KodekX | Application Modernization Development
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Teaching material agriculture food technology

Test Driven Development - Caleb Tutty

  • 1. TEST DRIVEN DEVELOPMENT Auckland WebDev Nights Meetup - 26th April 2012 Sunday, 29 April 12
  • 2. Who are you? Hi, I’m Caleb Tutty - [that’s Tuh-tee] Ruby on Rails developer working at onebigvoice twitter: @Caleb_T email: caleb@prettymint.co.nz github: https://github.com/tuttinator Feel free to pipe up with questions at any point, but there will be time at the end too. Sunday, 29 April 12
  • 3. What do I mean by testing? Automated testing. Tests written by developers to check the functionality of their application behaves as they expect it to. (Assertions). These tests are run by a test suite. Test broadly fall into two groups - unit tests and integration tests Unit tests look at isolated parts of functionality, and ensuring that each part does what you thought it should. (e.g. Controllers and Models) Integration tests are higher level - and aimed at the integrated user experience. These test that everything plays nicely with each other (e.g. the View layer interacting with Controllers and models) Sunday, 29 April 12
  • 4. Cool, got it. ...so when should I test? Sunday, 29 April 12
  • 5. Cool, got it. ...so when should I test? Not in production! Before you merge into the master branch of your source control Actually, TATFT Sunday, 29 April 12
  • 6. TAFT? Test all the f@#&ing time.* Bryan Liles - http://www.confreaks.com/videos/496- rubyhoedown2008-lightning-talk-tatft-test-all-the-f-in-time * Remember this as a qualification for later: “Quidquid latine dictum sit, altum sonatur.” Sunday, 29 April 12
  • 7. Really, all the time? Why? Tests give you notifications when a change breaks part of your app Tests tell you where to look Tests document your application Tests help you work in teams Tests mean that you can come back to a feature later and remind you what the hell you were doing Sunday, 29 April 12
  • 8. ENOUGH TALKING, NOW SHOW ME SOMETHING COOL Sunday, 29 April 12
  • 9. “Quidquid latine dictum sit, altum sonatur.” Anything in Latin sounds profound... Sunday, 29 April 12
  • 10. Too much testing? “I get paid for code that works, not for tests, so my philosophy is to test as little as possible to reach a given level of confidence (I suspect this level of confidence is high compared to industry standards, but that could just be hubris). If I don’t typically make a kind of mistake (like setting the wrong variables in a constructor), I don’t test for it. I do tend to make sense of test errors, so I’m extra careful when I have logic with complicated conditionals. When coding on a team, I modify my strategy to carefully test code that we, collectively, tend to get wrong.” - Kent Bent, of Test First development fame source: http://stackoverflow.com/questions/153234/how-deep-are-your-unit-tests/ 153565#153565 Sunday, 29 April 12
  • 11. Too much testing? “When developers first discover the wonders of test-driven development, it’s like gaining entrance to a new and better world with less stress and insecurity. It truly is a wonderful experience well worth celebrating. But internalizing the benefits of testing is only the first step to enlightenment. Knowing what not to test is the harder part of the lesson.” - DHH (creator of Rails) source: http://37signals.com/svn/posts/3159-testing-like-the-tsa Sunday, 29 April 12
  • 12. but testing is only for Rails devs, amirite? Nope! PHP https://github.com/sebastianbergmann/phpunit/ http://symfony.com/doc/current/book/testing.html Python http://pytest.org/latest/ Node.js and JavaScript http://pivotal.github.com/jasmine/ http://elegantcode.com/2011/03/07/taking-baby-steps-with-node-js-bdd-style-unit-tests-with-jasmine-node-sprinkled-with-some-should/ AS3 - I know there’s a Flex Dev in the audience http://asunit.org/ .NET - Visual Studio has unit testing since VS 2005 - http://msdn.microsoft.com/en-us/library/ms243147.aspx (well.. except for the free Express versions - http://greenicicleblog.com/2010/04/13/visual-studio-2010-express-no- tests-please/ and http://www.hexsaw.org.uk/2011/01/13/once-more-on-tdd-and-microsoft-visual-studio-2010-express-edition/ ) “I’m not one who says everything should be free. Microsoft do not claim to offer a free full-blown development environment; that’s OK. But from all things that you can leave out: why does it have to be the all abilities to run unit tests? That seems like a strange signal towards the importance of quality.” Sunday, 29 April 12
  • 13. is there moar? Beyond the scope of this talk: Factories versus Fixtures Cucumber and BDD JavaScript testing Spork and Continuous Integration Servers Sunday, 29 April 12