Posts on the web suggest that you can profile tests in Visual Studio by right-clicking and selecting "Profile Test": http://adamprescott.net/2012/12/12/performance-profiling-for-unit-tests/ But I only see "Run Test" and "Debug Test" for my NUnit tests, and the same for xUnit.NET. What am I missing in order to profile tests? Is this just not supported in Community edition, or I am missing some configuration or component?
(It would seem odd if it's not supported in Community, given I can profile executables in Community, and thus could painfully work around this issue by creating an executable that runs the test, and profile that. Why support profiling executables but not profiling tests?)
重现 NUnit 的步骤:在 Visual Studio Community 2015 中创建新的 C# 库项目,将http://nunit.org/index.php?p=quickStartSource&r=2.6.4的内容粘贴到新文件中,安装 NuGet 包如下:
<packages>
<package id="NUnit" version="2.6.4" targetFramework="net452" />
<package id="NUnit.Runners" version="2.6.4" targetFramework="net452" />
<package id="NUnitTestAdapter" version="2.0.0" targetFramework="net452" />
</packages>
甚至重新启动了 Visual Studio。测试显示在测试资源管理器中并且可以运行,但右键单击菜单上没有可用的“配置文件测试”选项。还尝试了 xUnit.net 的等效步骤,但没有任何乐趣。