Announcement: NDDNUG – Automated Unit Testing

July 29, 2007

I’m going to have another chance to refine my “real world unit testing” talk. I’ll be presenting at the North Dallas .Net User Group this Wednesday (August 1) at 6:30pm. The topic will cover unit testing, dependency injection and mocks/stubs using NUnit and RhinoMocks. The talk is VERY demo intensive and should be fun as well as informative. You can sign up here to attend – the pizza is free and the talk will certainly be interesting.

UPDATE: Here are the files I used for my presentation: PowerPoint and source.


Using Embedded Resources for Unit Testing…

July 10, 2007

I’ve often had to use XML documents in my unit testing. In the past, I’ve always done a concatenation to string together a document.

Xml document concat

However, I came across a post on Haacked that lead me to a better solution, embedded resources. Basically, you add a document to your project and mark it as an “Embedded Resource” rather than “Content” in the “Build Action” attribute.

Mark resource as embedded instead of content

This will pack it into the unit testing dll and allow you to extract it from the assembly. No more missing documents causing failing tests! In my custom class, I’ve defined a method for unwrapping the resource that allows you to pass in arguments that it will use for customizing the xml nodes. I found this to be simpler than attempting to navigate the document and update the nodes although I’m guessing it may be less performant.

Unwrap Method

One thing to be sure of with this, is that you use a centralized location for the resources so that your lookup doesn’t fail. So now I’m able to write my tests such that their intent is clear and the code is clean.

Resourced Test

Although I haven’t had the need yet, I could see where this could easily grow into handling multiple types of documents but I’ll hold off on that code until I need it. 🙂

Automated Unit Testing with Visual Studio 2005 Presentation

June 15, 2007

The talk went pretty well – I believe there were about 175 people registered so it was quite a turnout. I didn’t have a chance to get thru to all of my demos but I think that I at least got folks started in the right direction. Sadly, the dependency injection portion of the talk took the biggest hit and it’s really the most important part, in my opinion, since it’s what allows you to deal with “real” code. Maybe that just means I’ll have to give the talk again. 🙂 Regardless, I’m posting the AUT PowerPoint and the solutions ZIP (this has the starting version as well as the completed version).

Thanks to everyone who showed up for the talk. Feel free to comment below and if you have pics or anything, please let me know. I’d love to see them.

Announcement: DDNUG – Automated Testing with Visual Studio 2005

June 6, 2007

Apparently, they’re going to continue to allow me to get up in front of people and talk since it turns out I’m not half bad at it. I’ll be presenting a the Dallas .NET User Group on June 14th so head over and sign up – the pizza is free and, at worst, you’ll get to laugh and heckle me. The talk is being billed as programmer testing since I’m not going to stick to strict Test Driven Development (I’ll explain why in the talk). I’ll cover the basics and principles as well as MSTest, NUnit, RhinoMocks, and TestDriven.Net. Heck, I may even grab someone and doing a quick round of the TDD Pairing Game if I’m feeling randy.

Once again, I’m a little nervous too but that’s what makes it fun. Hope to see you there.

UPDATE: I’ve posted here for the presentation content.

“Zany” About MbUnit…

January 28, 2007

It looks like Sean has been working hard on my FAVORITE unit testing GUI – Zanebug. He’s updated it to the latest version of NUnit (2.2.9) and added support for MbUnit tests (here’s a post with screenies). Now it really is “all that and a bag of chips”…. (did I really just say that?) Regardless, if you’re not using it as your test runner – you’re missing out big time. Guess I don’t have a reason to put off trying out MbUnit anymore.