Last year, at PDC, I sat down with Adam Cogan, of SSW, during an MSDN magazine party. Feeling the guilty pleasure of totally geeking out while a decent party was going on, Adam led a group of geeks through some of his very cool software tools. Somewhere during the discussion, he mentioned that he deploys his unit test, along with a test runner, with his shrinkwrapped application. That got my attention, since I’d never thought of them like that. I called him on it, and he explained. Now, there seems to be a visceral reaction from folks against the idea. Here’s WHY it makes sense to deploy unit tests and a test runner with you application:
- Customer – “Your stupid app lost all my contact data!”
- Help Desk – “Maybe I can help. Go to Help -> Analyze”
- Customer – “OK. I see this list of green and red dots with text.”
- Help Desk – “Can you read me the line next to the first red dot?”
- Customer – “It says ‘Can’t find database at C:myappcontacts.mdb'”
- Help Desk – “Hmm… Can you browse to that directory?”
- Customer – “No, I deleted it to have room for more mp3’s”
- Help Desk – “Oh… That’2013-08-28 13:41:29’s a file required for our app to run. Did you subscribe to our backup service?”
- Customer – “Yes.”
- Help Desk “Good, go to Tools -> Options -> Restore Contact…”
You get the idea. It rocks for troubleshooting those pesky support calls from customers. For a lot more information, and a very nice screenshot, see Adam Cogan’s original posting on this topic! You can find the specific recommendation in his menu unit tests best practice. (While you’re there, check out the rest of his best practices, he has a huge number of great ideas.)
Unfortunately, you cannot ship your Team System unit tests with your application. I know there’s an NUnit to VSTS Unit Test converter. Does anyone know if VSTS Unit Tests can be converted to NUnit or MbUnit unit tests, so that all of us using VSTS Unit Tests can implement this best practice?
Adam Cogan claims he got the idea from James Newkirk (of NUnit fame). That may be the case, but I’ll have to credit Adam. 🙂 He’s got so many best practices on his site (see this rule that covers shipping unit tests for an example) that if he didn’t get the idea from Newkirk, he likely would have thought of it himself!
UPDATE TWO: This IS Adam’s idea! James simply wanted a distributable test harness for developers to use! I misunderstood his first comment to me! (By the way, if you have comments on this post, or any other, please send email to steve+comments[at]accentient.com. We’ve had to disable comments until we find a way to more effectively eliminate comment spam.)