Featured Post

Visual Studio for Windows vs XCode for Mac OS X

The other day I was playing on my aging Powerbook and thought I’d investigate writing applications on Mac OS X using XCode.  I tried several years ago but honestly after reading some documentation on Apple’s web site I wasn’t any better off than when I started.  Instead of going the...

Read More

When Bad UnitTests Don’t Know They Are Good

Posted by Keith Elder | Posted in .Net | Posted on 10-04-2008

3

I was writing a test earlier today  trying to play nice with the red first green later crowd.  When I first wrote my test it showed red.  It didn’t work, this was good.  I went in and wrote what I thought was “green” code.  I ran it and whoops I didn’t mark my dummy class public so the XML serializer blew up.  My test failed again.  I fixed that quicly and ran the test again and it failed again!  I looked at the message and this was staring me in the face.

Assert.AreEqual failed.
Expected: <system.xml.serialization.xmlserializer>
Actual:       <system.xml.serialization.xmlserializer>

Yah.  I’m at a loss too.  Doesn’t this test know that it was suppose to pass?  I feel like Adam Sandler in Happy Gilmore.    “Why won’t you just get in the hole?!!!”.