views:

710

answers:

2

I'm trying to setup a post-build event in .NET 3.5 that will run a suite of unit tests w/ MS test. I found this post that shows how to call a bat file using MbUnit but I'm wanting to see if anyone has done this type of thing w/ MS Test?

If so, I would be interested in a sample of what the bat file would look like

+3  A: 

Personally I would not recomment running unit tests as a part of the compilation process. Instead, consider something like ReSharper (+ appropriate Unit Test Runner or how do they call these nowadays) or some other GUI runner.

Anton Gogolev
I agree, but my fellow developers are not doing just this ... so I'm trying to have this post-build enforce it ...
Toran Billups
+1 for suggesting R#.
Mark
+1  A: 

Instead of a doing it in a post build event, that will happen every time you compile, I would look at setting up a Continuous Integration Server like CruiseControl.Net. It'll provide you a tight feedback cycle, but not block your work with running tests every time you build your application.

If you are wanting to run the set of tests you are currently developing, Anton's suggestion of using ReSharper will work great. You can create a subset of tests to execute when you wish and it's smart enough to compile for you if it needs to. While you're there picking up the demo, if you don't already have a license, pick up Team City. It is another CI server that has some promise.

If you are wanting to use this method to control the build quality, you'll probably find that as the number of tests grow, you no longer want to wait for 1000 tests to run each time you press F5 to test a change.

Mark
Good suggestions - I am using VS2008 and can run my tests quickly (as you mentioned R#). We purchased TFS late last year ... but for some reason the team dedicated to getting this up is taking some time :(
Toran Billups
For now, you could setup CC.Net, or another CI server besides Team Build, to run on your local box, or a make-shift server (aka an unused desktop) stuck under someone's desk. We struggled with getting the "enterprise" team to setup the "enterprise" solution so we did it our self.
Mark