Practical .NET Unit Testing – Free paper released

I’ve been working on a unit testing paper that sums up my experience in unit testing, and discusses some of the core information that I feel is important about the subject. It’s very much a work in progress, but I wanted to get it out sooner rather than later. I’ll be continuously updating it as time goes on.

Update: I updated the PDF location to one that doesn’t require registration.

Practical .NET Unit Testing

There are some really great books out there about unit testing, but I think some of them are trying too hard to be long enough to be considered a “book”. I set out to create a document that fills the gap between the various snippets of information from blog posts, and the comprehensive books on the subject. If you’re interested in something a bit more in-depth, here are some great books on the subject:

The paper currently consists of 5 main sections:

  • Why Write Unit Tests?
  • Unit Test Mechanics
  • Common Unit Testing Strategies
  • Designing for Testability
  • Advanced Techniques

Here is a more complete snapshot of the current outline:

  • Introduction
  • Unit Testing & Managers
  • What Unit Tests Really Do
  • Types of Testing
  • Testing Framework
  • Test Runner
  • Unit Test Structure
  • Other Test Attributes
  • What is Refactoring?
  • Test Driven Development
  • Evolving Code
  • When Should You Write Unit Tests?
  • Test is for Functionality, Not Code!
  • The Constraints of Reality
  • Interfaces – Quick Overview
  • Using a Mocking Framework
  • Stubs
  • The Test Driven Design Paradox
  • Testing Under Pressure
  • Extracting Duplicate Logic
  • Modular Design Benefits

So what are you waiting for? Go check it out online instantly, you can even download it as a PDF if you like. Is anything missing? Is anything just plain wrong? I’d love to hear your feedback.

Remember, if you want to hear more about unit testing, I’ll be speaking in Northeast Wisconsin Saturday, May 9th.

Kick It!

18 Comments so far »

  1. Thomas Johnson said,

    Wrote on April 30, 2009 @ 8:54 pm

    I really like your paper. I’m fairly inexperienced with unit testing and it’s really helped to clarify things for me, especially the part about mock objects.

    Cheers

  2. Typemock said,

    Wrote on May 1, 2009 @ 7:25 am

    A really good paper !

  3. Peli said,

    Wrote on May 2, 2009 @ 10:51 pm

    You should talk about data-oriented unit tests i.e. MbUnit’s RowTest, etc… All unit test frameworks support this kind of testing. Once you’re there, you should take a look at Pex (http://research.microsoft.com/pex) which should give an idea where automated unit testing might be headed.

    Keep on the good work,
    Peli

  4. Free eBook: Practical .NET Unit Testing | Code-Inside Blog said,

    Wrote on May 3, 2009 @ 6:02 am

    [...] – Practical .NET Unit Testing [...]

  5. Free eBook: Practical .NET Unit Testing | Code-Inside Blog International said,

    Wrote on May 3, 2009 @ 6:06 am

    [...] – Practical .NET Unit Testing [...]

  6. welt-held.de » Blog Archive » .NET Unit Testing - Gratis Ebook said,

    Wrote on May 3, 2009 @ 12:31 pm

    [...] nettes Ebook zum Thema Unit Testing unter C# / [...]

  7. links for 2009-05-03 | Xelluloid said,

    Wrote on May 3, 2009 @ 7:13 pm

    [...] Practical .NET Unit Testing – Free paper released I’ve been working on a unit testing paper that sums up my experience in unit testing, and discusses some of the core information that I feel is important Share and Enjoy: [...]

  8. .NET Oldenburg Blog » Freies eBook "Practical .NET Unit Testing" said,

    Wrote on May 4, 2009 @ 1:50 am

    [...] ytechie tech blog habe ich soeben ein interessantes eBook zum Thema Unit Testing gefunden. Es ist (nicht zuletzt aufgrund der bisher nur 25 Seiten) etwas oberflächlich, deckt [...]

  9. Dew Drop - May 4, 2009 | Alvin Ashcraft's Morning Dew said,

    Wrote on May 4, 2009 @ 8:10 am

    [...] Practical .NET Unit Testing – Free paper released (Jason Young) [...]

  10. Samuel Carrijo said,

    Wrote on May 4, 2009 @ 2:09 pm

    On the 19th slide, there’s an example using the CompareTo method of IComparable, requiring it to return 1 for bigger, -1 for smaller; any other value if they are the same.

    Looking at the documentation of the method, I’ve checked that it works like this

    Less than zero (not strictly -1) => smaller
    Zero (strictly zero) => equal
    Greater than zero (not strictly 1) => bigger

    Check the table at http://msdn.microsoft.com/en-us/library/system.icomparable.compareto(VS.71).aspx

    Just a minor contribution. Still reading the paper, and liking what I read so far.

  11. Samuel Carrijo said,

    Wrote on May 4, 2009 @ 2:17 pm

    Another point in slide 19:

    “Programming the class against the interfaces is elegant for number of reasons. First, as I mentioned, we’re defining the “how” for retrieving the email addresses. (…)”.

    IMHO, interfaces define the “what” who implements the interface does, no matter how. The interface implementation defines “how” to do the “what”.

    Also, do any of you guys know any mock framework that lets me create partial mock without the need to create interfaces for everything or declaring a method as virtual? It doesn’t seem right to me modifying good code (e.g. creating an unnecessary interface) just to make testing easier.

    Thanks in advance

  12. Mahmoud Alam said,

    Wrote on May 15, 2009 @ 11:07 am

    Thank you …

  13. Mahmoud Alam said,

    Wrote on May 15, 2009 @ 11:10 am

    Thank you … :D

  14. PB said,

    Wrote on May 28, 2009 @ 11:12 am

    [...] – Practical .NET Unit Testing [...]

  15. slamidtfyn said,

    Wrote on June 23, 2009 @ 2:36 am

    Very good paper. Looking forward to read the yet not finished sections.

  16. links for 2009-08-11 | The Gryphin Experience said,

    Wrote on August 11, 2009 @ 3:03 pm

    [...] Practical .NET Unit Testing – Free paper released This paper currently consists of 5 main sections: * Why Write Unit Tests? * Unit Test Mechanics * Common Unit Testing Strategies * Designing for Testability * Advanced Techniques (tags: development .net unittesting) [...]

  17. B A L U said,

    Wrote on November 3, 2009 @ 4:24 am

    Good Stuff.

    Thank.

  18. Punit said,

    Wrote on December 23, 2009 @ 4:15 pm

    Appreciate your time and effort. thank you!

Comment RSS · TrackBack URI

Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

Comment: