Your SlideShare is downloading. ×
Test Driven Development - Caleb Tutty
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Test Driven Development - Caleb Tutty

686

Published on

The slides for Caleb Tutty's excellent talk on Test Driven Development, presented at the first Auckland Web Dev Nights meetup on the 26th April, 2012. …

The slides for Caleb Tutty's excellent talk on Test Driven Development, presented at the first Auckland Web Dev Nights meetup on the 26th April, 2012.

webdevnights.github.com

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
686
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. TEST DRIVEN DEVELOPMENT Auckland WebDev Nights Meetup - 26th April 2012Sunday, 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, TATFTSunday, 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 doingSunday, 29 April 12
  • 8. ENOUGH TALKING, NOW SHOW ME SOMETHING COOLSunday, 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#153565Sunday, 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-tsaSunday, 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 ServersSunday, 29 April 12
  • 14. QUESTIONS?Sunday, 29 April 12

×