Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Unit Testing 101

Jim Holmes
October 12, 2011

Unit Testing 101

Unit testing can save you time, money, and frustration by helping you create a safety net around your software to guarantee its stability and quality. This introductory session sets aside any testing methodologies such as Test or Behavioral Driven Development and instead focuses on the fundamentals of what unit tests are, how to write them, and some differences between the most popular unit test frameworks. You’ll also learn about organizing tests, creating test hierarchies, and heading off painful or brittle tests. We’ll also show you how to isolate dependencies using stubs, fakes, and mocks. You’ll leave this session with an understanding of how to get started writing unit tests.

Jim Holmes

October 12, 2011
Tweet

More Decks by Jim Holmes

Other Decks in Programming

Transcript

  1. Test Occasionally Write tests (maybe) for easy stuff, or to

    cover a bug. Occasionally, like. Wednesday, October 12, 11
  2. Test After Dev Write your system, then write some tests.

    Emphasis on “some” because it tends to get blown off... Wednesday, October 12, 11
  3. Test Driven Development Write tests first, then write code to

    make tests pass Wednesday, October 12, 11
  4. OK, BDD seriously “TDD helps you write software correctly, BDD

    helps you write the correct software.” --Aslak Hellesoy Focuses on how system should behave -- interactions & outcomes, not just inputs/outputs Wednesday, October 12, 11
  5. Flexibility & Speed I can change with confidence (or at

    least less fear) Wednesday, October 12, 11
  6. The Tools Test Frameworks MbUnit (Gallieo) www.Gallieo.org Nunit www.NUnit.org Mocking

    Frameworks Rhino Mocks http://is.gd/bCCk9 Moq http://is.gd/bCCim NMock http://nmock.org Telerik’s JustMock http://is.gd/bCCbq Wednesday, October 12, 11
  7. Books Roy Osherove's Art of Unit Testing Bob Martin's Agile

    Patterns & Principles in C# Hunt & Thomas's Pragmatic Unit Testing (C#/.NET) Wednesday, October 12, 11