Category特性为suites的测试提供另外一个可替换功能。个别测试用例或者fixtures可能被识别为一个特殊的类别。GUI和控制台程序都允许在运行的测试中包含或者排除指定一系列category。当使用了category是,只有选定等等测试才会执行。未选中的测试则根本不会报告。

这个功能在控制台中使用/include and /exclude参数,在GUI中使用单独的Categories选项卡来实现。GUI提供了可视化操作用于随时选择Categories。、

Test Fixture Syntax

namespace NUnit.Tests
{
  using System;
  using NUnit.Framework;

  [TestFixture]
  [Category("LongRunning")]
  public class LongRunningTests
  {
    // ...
  }
}
View Code

相关文章:

  • 2021-06-24
  • 2021-11-07
  • 2021-10-10
  • 2021-06-16
  • 2021-10-28
  • 2021-12-19
  • 2021-09-05
  • 2021-07-21
猜你喜欢
  • 2021-06-22
  • 2021-07-11
  • 2021-09-22
  • 2022-01-09
  • 2021-08-18
  • 2021-11-24
  • 2021-05-21
相关资源
相似解决方案