如何在VSTS上配置单元测试名称/说明?

时间:2018-08-16 14:26:43

标签: c# .net unit-testing azure-devops nunit

我有一个包含单元测试项目的解决方案。我正在使用NUnit v3.10.1和NUnit3TestAdapter v3.10.0。

是否可以配置测试名称在Visual Studio Team Services(VSTS)中的显示方式,也许显示测试类名称?目前,它仅显示测试名称:

Test names in VSTS

很难理解哪个测试属于哪个类。在这种情况下,我至少有两个测试类具有相同的测试名称。

使用Reshaper的测试运行程序运行相同的测试,很容易理解哪些测试属于哪些类:

Resharper unit tests grouped by project structure

我尝试设置TestFixture Attribute属性的TestName或设置Test AttributeDescription时没有运气:

[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上配置测试的名称?

1 个答案:

答案 0 :(得分:2)

否,无法对其进行配置。您可以提交UserVoice项目以提出产品改进建议。