Poor man's NUnit + Visual Studio integration

In part 4 of the series on ASP.NET MVC and NHibernate, we’ll be using NUnit. If you don’t already have some snazzy Visual Studio add-in with full NUnit integration, here’s a not-so-glitzy alternative. It’s not my idea and I’d love to give credit to the right person, but I’ve slept a lot since I first discovered this.

 

  1. In Visual Studio, on the Tools, choose External Tools.
  2. Click Add
  3. Title it NUnit or something similar.
  4. For the command, browse for the NUnit executable. In my case, it’s in C:Program Files (x86)NUnit 2.5.2binnet-2.0
  5. For the arguments, enter this: $(ProjectDir)binDebug$(TargetName)$(TargetExt) /run
  6. For the initial directory, enter this:$(ProjectDir)binDebug

It should look something like this:

image

 

Now, when you want to fire up NUnit, just choose it from the Tools menu. It’ll launch, load up the latest debug build of the current project, and start running the tests.

Of course, if you’re doing any kind of significant real-world project, especially with a team, you should really look in to snagging one of the awesome continuous integration (CI) setups out there. Every time you commit, it’ll build and test your app, send you the results, and with a little tweaking, even start a fresh pot of coffee. Oh. You are using some kind of source control, right? And it’s not Visual Source Safe, right?

Jason
- On a blogging high

blog comments powered by Disqus