博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
NUnit Console Command Line
阅读量:6818 次
发布时间:2019-06-26

本文共 3327 字,大约阅读时间需要 11 分钟。

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 for a full description of the syntax.

 

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 . 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.

 

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 . 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", 723)]  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

 

转载地址:http://xlbzl.baihongyu.com/

你可能感兴趣的文章
AliOS Things网络适配框架 - SAL
查看>>
数组 将一个数组的元素和另一个素组的元素相加,然后赋给第三个数组
查看>>
Python常用模块汇总
查看>>
sa提开放系统下的虚拟新贵Virtualbox权技巧之xp_regwrite替换sethc.exe
查看>>
SpringBoot开发案例之整合Dubbo提供者(一)
查看>>
变态的程序
查看>>
腾讯抄你肿么办 ?
查看>>
java多线程的Fork/Join
查看>>
ftp 服务器的配置
查看>>
JavaScript的浏览器兼容性问题小结。
查看>>
Oracle Hint的用法
查看>>
Postfix邮件系统
查看>>
《编写可读代码的艺术》读书文摘--第一部分 表面层次的改进
查看>>
使用Nodejs创建基本的网站 Microblog--《Node.js开发指南》 3
查看>>
网管工作是否值得做下去?
查看>>
神行者PD10-adb push逃脱ro权限
查看>>
JPA(四)之实体关系一对一
查看>>
如何使用羊驼自动生成缩略图的功能。
查看>>
定制化Azure站点Java运行环境(1)
查看>>
inotify用法简介及结合rsync实现主机间的文件实时同步
查看>>