【发布时间】:2026-01-06 21:40:01
【问题描述】:
我有一个包含单元测试项目的解决方案。我正在使用 NUnit v3.10.1 和 NUnit3TestAdapter v3.10.0。
有没有办法配置测试名称在 Visual Studio Team Services (VSTS) 中的显示方式,可能显示测试类名称?目前它只显示测试名称:
很难理解哪个测试属于哪个类。在这种情况下,我至少有 2 个具有相同测试名称的测试类。
使用 Reshaper 的测试运行器运行相同的测试,很容易理解哪些测试属于哪些类:
我尝试设置TestFixture Attribute 属性的TestName 或设置Test Attribute 的Description,但没有成功:
[TestFixture(TestName = "MemoryCacheManagerTests_TryGetItem", TestOf = typeof(MemoryCacheManager))]
public class MemoryCacheManagerTests_TryGetItem : MemoryCacheManagerTests
{
[Test(Description = "MemoryCacheManagerTests_TryGetItem_WithInvalidCacheKey_ShouldThrowArgumentException")]
[TestCaseSource(typeof(InvalidCacheKeyTestCases))]
public void WithInvalidCacheKey_ShouldThrowArgumentException(string key)
{
// ...
}
}
那么如何配置 VSTS 上的测试名称呢?
【问题讨论】:
标签: c# .net unit-testing azure-devops nunit