gpt4 book ai didi

unit-testing - NUnit 类别未显示在 Visual Studio 中

转载 作者:行者123 更新时间:2023-12-04 23:44:54 27 4
gpt4 key购买 nike

我想按功能对我的测试进行自定义分组,因此我使用了 nunit Category 属性,如下所示:

[Test, Category("Cat1")]
public void SomeMethod() { }

[Test, Category("Cat2")]
public void AnotherMethod() { }

但是在 Visual Studio 中没有显示类别,我看到的只是按持续时间或测试结果分组的默认值。我正在使用:
  • NUnit 2.6.4
  • Visual Studio 2012
  • NUnit 测试适配器 2.0.0.0

  • 我错过了什么?这似乎应该是一个明智的选择

    最佳答案

    您应该能够通过 Traits 对您的测试进行分组,其中包括 Category属性。如果你不能,那么你可能需要更新 your Visual Studio to at least Update 1 .针对 MS 框架的更详细描述是 here但是 TestAdapter 似乎允许它与 NUnit Category 属性一起正常工作。

    关于unit-testing - NUnit 类别未显示在 Visual Studio 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30891415/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com