我有Nunit单元测试,我需要运行作为我的MS构建的一部分..我知道运行所有测试将减慢构建所以,我需要只运行受影响的测试是否有任何方法来找到它. . 最佳答案 对于NUnit测试,AFAIK仅运行受影响的测试.但对于Visual Studio 2010 Ultimate / Test Professional中的MSTests,这是可能的:
Recommending Tests to Run That are Affected by Code Changes
You can use Visual Studio Ultimate or Visual Studio Test Professional
2010 to help you determine which tests might have to be run, based on
coding changes that were made to the application you are testing. To
be able to use this functionality, you have to use Team Foundation
Build to build your application and use Microsoft Visual Studio 2010
for version control for your source code
无论如何,您可以使用MSBuild Community NUnit Task从一组程序集中运行测试.您可以通过指定DependsOnTargets属性将此作为标准AfterBuild目标的依赖目标.
<NUnit Assemblies="..."
IncludeCategory="..."
ExcludeCategory="..."
ToolPath="$(NUnitDllsPath)"
ProjectConfiguration="$(Configuration)"
OutputXmlFile="$(NUnitOutputPath)\UnitTests.xml"
ContinueOnError="true">