We had a practice which included unit testing for a while now, but it entailed Nunit and MBunit with various build frameworks such as CruiseControl and VisualBuilder.
We are running VS2005, and wanted to include running the tests on developer boxes as part of a build, so that failed tests will flunk the build.
Using a post build event, this is easily done:
In the Post Build Events, enter:
The quotes around the MSTEST full path ensure that the space in the name "Program Files" is resolved correctly.
Changing directory to the target directory is easier than setting all explicit paths etc.
This could have been achieved by running a continuous integration server on each machine, but raises the setup complexity.
If MSTEST returns a less than success code, the build will fail.
If you further want to speed development compile/run cycle, you can create a new configuration:
Configuration Manager -> Active Solution Configuration (drop down) <New...> -> name a new debug configuration "Debug No Test"
In the new configuration, check each project in the solution except the test project.