Derik Whittaker



Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at
Unit Tests to the rescue

Today started off in a bad, bad way.  Because of some issues I had earlier in the week with my source control repository (SCR) I was doing a ton of work offline.  Today I was able to regain access to my SCR I decided to do a full get.  I was fully expecting SourceOffSite (crappy overlay tool on top of VSS -- BTW, VSS is the devil) to prompt me for conflicts or do merges...... NOPE

When I finished doing my SCR pull I re-opened Visual Studio and did a compile.  To my dismay I had TONS of build errors.  After about 3 seconds of looking into the errors I knew I was screwed.  It turns out I lost about 2 days worth of code because the source files were not merged they were overwritten....THIS SUCKS

The good news for me is that much of the code that was overwritten was plumbing work and was fixed in about 1 hour.  However, there was a bit of logic code that was overwritten as well.  This is where my unit tests came to the rescue.

Because I has pretty good code coverage with my tests I was able to re-create the logic with very little fear that the new implementation changed the intent of the original logic.  Also because I had my tests I was able to infer logic based on what the tests were meant to verify.

I am not trying to say that tests made this all ok, but having my tests did make me feel a little better in thinking that I have not broken anything.  Sadly, I wasted a large portion of my morning doing this.

Till next time,

[----- Remember to check out DimeCasts.Net -----]

Posted 10-02-2008 9:44 AM by Derik Whittaker
Filed under: , ,


Comments wrote Unit Tests to the rescue
on 10-02-2008 11:30 AM

You've been kicked (a good thing) - Trackback from

Dave Schinkel wrote re: Unit Tests to the rescue
on 10-02-2008 11:32 AM

That's a very good point.  Never really thought of the fact that your unit tests could save you time in rebuilding that lost logic.

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Google Reader or Homepage Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of
Red-Gate Tools For SQL and .NET


SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
NHibernate Profiler
Balsamiq Mockups
JetBrains - ReSharper
Web Sequence Diagrams
Ducksboard<-- NEW Friend!


Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers


Community Server (Commercial Edition)