[翻译]NUnit---Range and Repeat Attributes(十五)
RangeAttribute (NUnit 2.5)
Range特性用于为参数话测试方法的参数的值范围指定一个值,与Random特性一样,NUnit会将每个参数的值组合为一些了测试用例,所以如果为一个参数设定数据那么必须为所以参数设定数据。默认情况下,NUnit使用参数的数据组合所有可能的情形。同时,可以使用在方法的指定特性上进行更改。
Range特性支持一下构造
public RangeAttribute( int from, int to );
public RangeAttribute( int from, int to, int step );
public RangeAttribute( long from, long to, long step );
public RangeAttribute( float from, float to, float step );
public RangeAttribute( double from, double to, double step );
Example
The following test will be executed nine times, as follows:
MyTest(1, 0.2)
MyTest(1, 0.4)
MyTest(1, 0.6)
MyTest(2, 0.2)
MyTest(2, 0.4)
MyTest(2, 0.6)
MyTest(3, 0.2)
MyTest(3, 0.4)
MyTest(3, 0.6)
[Test]
public void MyTest(
[Values(,,) int x,
[Range(0.2,0.6,0.2] double d)
{
...
}
See also...
- ValuesAttribute
- RandomAttribute
- SequentialAttribute
- CombinatorialAttribute
- PairwiseAttribute
RepeatAttribute (NUnit 2.5)
测试方法需要指定执行次数时可以使用Repeat特性来实现。如果其中一次失败,则未执行不会再执行,并且会报告为一个失败。
NOtes:
1、目前不能在TestFixture或者测试套件(test Suite)中使用Repeat特性。只有蛋哥测试才能使用。
2、由于参数化的测试方法代表一个测试套件,所以Repeat特性在修饰参数化测试方法时会被忽略。
[翻译]NUnit---Range and Repeat Attributes(十五)的更多相关文章
- Gradle 1.12用户指南翻译——第四十五章. 应用程序插件
本文由CSDN博客貌似掉线翻译,其他章节的翻译请参见: http://blog.csdn.net/column/details/gradle-translation.html 翻译项目请关注Githu ...
- Gradle 1.12 翻译——第十五章. 任务详述
有关其他已翻译的章节请关注Github上的项目:https://github.com/msdx/gradledoc/tree/1.12,或访问:http://gradledoc.qiniudn.com ...
- Gradle 1.12用户指南翻译——第二十五章. Scala 插件
其他章节的翻译请参见: http://blog.csdn.net/column/details/gradle-translation.html 翻译项目请关注Github上的地址: https://g ...
- Gradle 1.12用户指南翻译——第三十五章. Sonar 插件
本文由CSDN博客万一博主翻译,其他章节的翻译请参见: http://blog.csdn.net/column/details/gradle-translation.html 翻译项目请关注Githu ...
- Gradle 1.12用户指南翻译——第六十五章. Maven 发布(新)
其他章节的翻译请参见:http://blog.csdn.net/column/details/gradle-translation.html翻译项目请关注Github上的地址:https://gith ...
- 如鹏网学习笔记(十五)ASP.NET MVC核心基础笔记
一.ASP.Net MVC简介 1,什么是ASP.NET MVC? HttpHandler是ASP.net的底层机制,如果直接使用HttpHandler进行开发难度比较大.工作量大.因此提供了ASP. ...
- NeHe OpenGL教程 第四十五课:顶点缓存
转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...
- NeHe OpenGL教程 第三十五课:播放AVI
转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...
- NeHe OpenGL教程 第二十五课:变形
转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...
随机推荐
- android mapView
1.Because the Maps library is not a part of the standard Android library, you must declare it in the ...
- RMQ(或运算)
RMQ https://ac.nowcoder.com/acm/contest/283/J 题目描述 按位或运算:处理两个长度相同的二进制数,两个相应的二进位中只要有一个为1,该位的结果值为1.例如5 ...
- day12:vcp考试
Q221. An administrator is creating a new Platform Service Controller Password Policy with the follow ...
- 2-Qt关闭子窗口时执行特定代码
https://blog.csdn.net/naibozhuan3744/article/details/82689434 本文主要总结在关闭qt的QWidget子窗口瞬间,执行特定代码.由于主窗口关 ...
- Pull to RefreshListView 添加HeaderView
使用listView.addHeaderView(view) 可以在 listView 上方添加一个view视图 ,使listView和这个view连接在一起 效果上看上去是一个整体 一般用于上拉刷新 ...
- actionBar_Tab导航
actionBar配合碎片使用 初始化actionBar要注意设置actionbar的导航模式 package com.qf.actionbar04_tab; import java.io.File ...
- 改变父元素的透明度,不影响子元素的透明度—css
1.如果我们给父元素添加opacity:0.4后,子元素的red颜色也变成了0.4的透明度, 例子如下: <!DOCTYPE html> <html> <head> ...
- APScheduler 浅析
前言 APScheduler是python下的任务调度框架,全程为Advanced Python Scheduler,是一款轻量级的Python任务调度框架.它允许你像Linux下的Crontab那样 ...
- usaco oct09 Watering Hole
Farmer John希望把水源引入他的N (1 <= N <= 300) 个牧场,牧场的编号是1~N.他将水源引入某个牧场的方法有两个,一个是在牧场中打一口井,另一个是将这个牧场与另一个 ...
- json.dumps错误:'utf8' codec can't decode byte解决方案-乾颐堂
一次在使用json.dumps()过程中,出现错误提示: ERROR:"UnicodeDecodeError: 'utf8' codec can't decode byte 0xe1 in ...