I just got back from the North Dallas .NET User Group meeting tonight where Dave O'Hara presented on Automated Unit Testing. I thought the talk was a great primer for people who were not familiar with Unit Testing philosophy, and showed off a lot of the tools that are available to developers that makes it easy for people to build reliable, reusable unit tests. He had a great example of the old "Winforms Test Harness" approach that we all used to use (admit it - you did it too...) and how difficult that is to manage over time and across developers / development teams. Using tools like VSTS, NUnit, RhinoMock and other frameworks, he showed that it really is easy to build reusable unit tests and how valuable they are to keep around.
Here's a couple of my notes from the session
- AUT is all about making sure your code does what you think it should
- AUT != TDD (his talk was not about TDD - it was only meant to cover tools, tips and techniques for doing Automated Unit Tests)
- It's not as hard as people think it is to do - it's more of a mind-shift - and the tools today make it really easy to do
- It's every developer's job to test their own code in a repeatable, reliable way
- Code coverage is an important part of verifying whether or not your tests are making an impact on your system (i.e. if the coverage % is too low, you're not testing enough of your system)
- If you start working on a project that has Unit Tests in it, RUN THEM BEFORE YOU CHANGE ANYTHING! If they don't work before you get started, you'll be chasing your tail for a long time through code you didn't write (or possibly change)
Here are some links to the original presentation materials (back in June) that I found on Dave's blog. Check back there in case he updates them...