在 Visual Studio 中禁用 运行 一些 xunit 测试(通过 Resharper)

Disable running some xunit tests in Visual Studio (by Resharper)

我有一些集成测试(很长 运行ning)。如果它们在主要解决方案中并且我选择 运行 所有测试,这些测试也会被拾取。 如何避免?

这些测试被假定为 运行来自 CI 上的脚本。 Traits 没有帮助(AFAIK),因为 R# 也会拾取它们。

在 resharper 中使用不同的播放列表,或 运行 不同的特征(测试资源管理器)。 In Visual Studio Test, how to make a playlist which automatically excludes certain tests?

这道题间接给出了答案:

xUnit中: 您添加一个特征:

[Trait("Category", "LongRunning")]
[Fact]
public void Test()
{
}

在 "ReSharper->Options->Unit Testing" 中您需要排除类别 "LongRunning":

PS,保存此更改时,您可能希望将其保存到 "team-shared" 层,以便您的团队以相同的方式保存。