AFAIK only works with verified tests, it has not yet been completed for NUnit tests. But this is possible for MSTests in Visual Studio 2010 Ultimate / Test Professional:
Recommendation to run tests caused by code changes
You can use Visual Studio Ultimate or Visual Studio Test Professional 2010 to help you determine which tests you may need to run based on the encoding changes that were made to the application under test. To be able to use this functionality, you must use Team Foundation. Build your application and use Microsoft Visual Studio 2010 for version control for your source code.
In any case, you can use the MSBuild Community NUnit Task to run tests from a set of assemblies. You can do this as the dependency target of the standard AfterBuild
target by specifying the DependsOnTargets
attribute.
<NUnit Assemblies="..." IncludeCategory="..." ExcludeCategory="..." ToolPath="$(NUnitDllsPath)" ProjectConfiguration="$(Configuration)" OutputXmlFile="$(NUnitOutputPath)\UnitTests.xml" ContinueOnError="true">
source share