Unit Tests with Visual Studio 2008 (screencast)

Test Driven Development (TDD) has long been advocated as a "best practice" in software development.  Without picking apart the details with this theory, I'll just summarize the concept:

  • prior to jumping in with both feet, writing functional code, start with stubbed out methods/functions/classes/etc... (you might use Class Designer for this part)
  • second, create a test harness that aligns with the functional requirements... these should test for "expected" results and compare them with "actual" results returned from the functional code (class/method/etc...)
  • finally start adding code to your stubbed classes/methods... and refining this code until your tests harness receives all "expected" results

Creating these test harnesses can be a cumbersome task and seem to take time away from the valuable development time.  Visual Studio can automate a majority of this for you saving you tons of time without bolt-on 3rd party tools, and most importantly recover that valuable development time "without" sacrificing quality code!

Instead of rambling, I recorded a quick 7 minute screencast to get you started in Unit Testing with Visual Studio 2008:

Note: This just touches the surface, but will hopefully prove a decent introduction.