https://github.com/nunit/docs/wiki/Console-Command-Line

The console interface runner is invoked by a command in the form

    NUNIT3-CONSOLE [inputfiles] [options]

where inputfiles is one or more assemblies or test projects of a type that NUnit can process and options is zero or more options.

Input files and options may be mixed in any order.

--where=EXPRESSION

An expression indicating which tests to run.

It may specify test names, classes, methods, categories or properties comparing them to actual values with the operators ==, !=, =~ and !~.

See Test Selection Language for a full description of the syntax.

https://github.com/nunit/docs/wiki/Test-Selection-Language

cat - A category assigned to the test, e.g. SmokeTests

Filtering Based on Properties

Although the syntax will accept any property name - including names that don't actually exist - filtering will only work on existing, string-valued properties. The following properties are created by NUnit and have string values:

  • Author
  • Category
  • Description
  • SetCulture
  • SetUICulture
  • TestOf
  • IgnoreUntilDate

In general, these properties were not created with filtering in mind, but you can use them if it suits your needs. Using the Category property currently accomplishes the same thing as the cat keyword. You should be aware that the use of these properties by NUnit is considered an implementation detail and they may change in the future.

We envision that most filtering by property will be based on user-defined properties, created for this purpose by inheriting from Property Attribute. When defining a property, you should keep the limitation to string values in mind. For example, a PriorityAttribute taking values of "High", "Medium" and "Low" could be used for filtering, while one that took the integers 1, 2 and 3 could not.

https://github.com/nunit/docs/wiki/Property-Attribute

Usage Note

The PropertyAttribute is not currently used for any purpose by NUnit itself, other than to display them in the XML output file and in the Test Properties dialog of the gui. You may also use use properties with the --where option on the command-line in order to select tests to run. See Test Selection Language. Note that his filtering will only work for properties where the values have type string.

namespace NUnit.Tests
{
using System;
using NUnit.Framework; [TestFixture, Property("Location", )]
public class MathTests
{
[Test, Property("Severity", "Critical")]
public void AdditionTest()
{ /* ... */ }
}
}

后台所对应的函数

    //
// Summary:
// Construct a PropertyAttribute with a name and string value
//
// Parameters:
// propertyName:
// The name of the property
//
// propertyValue:
// The property value
public PropertyAttribute(string propertyName, string propertyValue);
//
// Summary:
// Construct a PropertyAttribute with a name and int value
//
// Parameters:
// propertyName:
// The name of the property
//
// propertyValue:
// The property value
public PropertyAttribute(string propertyName, int propertyValue);
//
// Summary:
// Construct a PropertyAttribute with a name and double value
//
// Parameters:
// propertyName:
// The name of the property
//
// propertyValue:
// The property value
public PropertyAttribute(string propertyName, double propertyValue);

另外还可以继承PropertyAttribute,实现自定义的property attribute

最新文章

  1. window7 桌面新建快捷方式方法
  2. PHP array 操作函数
  3. iOS开发 QQ粘性动画效果
  4. .NET (四)委托第四讲:内置委托Comparison
  5. POJ 3233 Matrix Power Series 矩阵快速幂+二分求和
  6. UESTC 915 方老师的分身II --最短路变形
  7. Spring注释与简化配置
  8. 使用fiddler2抓取手机发出的请求信息
  9. 《APUE》第三章笔记(3)
  10. Unity 用C#脚本读取JSON文件数据
  11. 【转】ListView与RadioButton组合——自定义单选列表
  12. State Design Pattern 状态设计模式
  13. CSS选择器大汇总
  14. 自动化运维工具——ansible详解(二)
  15. oracle中的listener.ora和tnsnames.ora
  16. Cocos Creator 橡皮差(刮刮卡)功能(转)
  17. JavaSE-2018.12.20更新
  18. JS 事件循环机制 - 任务队列、web API、JS主线程的相互协同
  19. arithmetic-02
  20. poj 1759(二分)

热门文章

  1. # Nginx常见问题
  2. Tour UVA - 1347
  3. Android ViewPager使用方法小结
  4. EF CodeFirst 基础命令
  5. 移动APP 微信支付完整过程(wxPay 方案一)
  6. matlab学习下拉菜单Pop-Up Menu的基本用法
  7. 无需编写代码,API业务流程测试,零代码实现
  8. PKU 1019 Number Sequence(模拟,思维)
  9. id和class命名规范
  10. NET 爬虫