NUnit是一款堪与JUnit齐名的开源的回归测试框架,供.net开发人员做单元测试之用,可以从www.nunit.org网站上免费获得,最新版本是2.5。Mono 3.2 源码安装的,在/usr/bin/ 下面有2.4.8 版本:

[azureuser@mono /]$ /usr/bin/nunit-console4
NUnit version 2.4.8
Copyright (C) 2002-2007 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment -
   OS Version: Unix 2.6.32.279
  CLR Version: 4.0.30319.17020 ( 3.3.0 (master/1022c50 Thu Jul 25 13:16:35 UTC 2013) )

fatal error: no inputs specified

本文用一个BDD的框架Bddify 进行测试,关于这个框架的更详细信息可以参看 BDDfy In Action

[azureuser@mono /]$ sudo /usr/bin/nunit-console4 /home/azureuser/BddifySamples/Bddify.Samples.dll
NUnit version 2.4.8
Copyright (C) 2002-2007 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment -
   OS Version: Unix 2.6.32.279
  CLR Version: 4.0.30319.17020 ( 3.3.0 (master/1022c50 Thu Jul 25 13:16:35 UTC 2013) )

.Story: Account holder withdraws cash
        As an Account Holder
        I want to withdraw cash from an ATM
        So that I can get money when the bank is closed

Scenario: Account has insufficient fund
        Given the Account Balance is $10
          And the Card is valid
          And the machine contains enough money
        When the Account Holder requests $20
        Then the ATM should not dispense any Money
          And the ATM should say there are Insufficient Funds
          And the Account Balance should be $20
          And the Card should be returned

.Story: Account holder withdraws cash
        As an Account Holder
        I want to withdraw cash from an ATM
        So that I can get money when the bank is closed

Scenario: Account has sufficient fund
        Given the account balance is $100
          And the Card is valid
          And the machine contains enough money
        When the account holder requests $20
        Then the ATM should dispense $20
          And the account balance should be $80
          And the card should be returned

.Story: Account holder withdraws cash
        As an Account Holder
        I want to withdraw cash from an ATM
        So that I can get money when the bank is closed

Scenario: Card has been disabled
        Given the Card is disabled
        When the Account Holder requests 20
        Then Card is retained
          And the ATM should say the Card has been retained

.Story: Tic tac toe
        As a player
        I want to have a tic tac toe game
        So that I can waste some time!

Scenario: Cat's game
        Given the board rows looks like [X, O, X], [O, O, X] and [X, X, O]
        Then it should be a cats game

.Story: Tic tac toe
        As a player
        I want to have a tic tac toe game
        So that I can waste some time!

Scenario: O wins
        Given the following board X, X, O, X, O,  ,  ,  ,
        When the game is played at (2, 0)
        Then the winner should be O

.Story: Tic tac toe
        As a player
        I want to have a tic tac toe game
        So that I can waste some time!

Scenario: When x and o play their first moves
        Given a new game
        When X and O play on (0, 0), (2, 2)
        Then the board state should be X,  ,  ,  ,  ,  ,  ,  , O

.N.Story: Tic tac toe
        As a player
        I want to have a tic tac toe game
        So that I can waste some time!

Scenario: X wins
        Given the board rows looks like [X, X, O], [X, X, O] and [O, O,  ]
        When x plays in the bottom right
        Then the winner should be x

Tests run: 7, Failures: 0, Not run: 1, Time: 0.775 seconds

 

Introduction to bddify: A Simple to Use and Extend BDD Framework for .NET

Mono 3.2 上跑NUnit测试的更多相关文章

  1. RazorEngine 3.3 在Mono 3.2上正常运行

    RazorEngine 是一个简化的模板引擎基于微软新的Razor 解析引擎, Razor是在 ASP.NET MVC3 和 Web Pages中引入的.RazorEngine 提供了一个外包装和额外 ...

  2. 让python在hadoop上跑起来

    duang~好久没有更新博客啦,原因很简单,实习啦-好吧,我过来这边上班表示觉得自己简直弱爆了.第一周,配置环境:第二周,将数据可视化,包括学习了excel2013的一些高大上的技能,例如数据透视表和 ...

  3. Nunit测试工具使用实例

    前言: 本文主要是介绍了Nunit的基本使用,其中参详了很多已有的文章,由于最近要使用其进行测试,所以对网上的文章做了下整理,同时加入了一些自己的实践. NUnit的属性 TestFixture 它标 ...

  4. 在win7上跑基于任少卿作者代码修改的RPN+BF实验

    1.前言 之前在win10上成功的跑起来faster-rcnn的实验,并且跑了一下CaltechPedestrian的数据集,但是效果一直不理想,折腾了好久也没弄清楚到底原因出在哪里,直到读了Is F ...

  5. 利用Tengine在树莓派上跑深度学习网络

    树莓派是国内比较流行的一款卡片式计算机,但是受限于其硬件配置,用树莓派玩深度学习似乎有些艰难.最近OPENAI为嵌入式设备推出了一款AI框架Tengine,其对于配置的要求相比传统框架降低了很多,我尝 ...

  6. 让“是男人就下到100层”在Android平台上跑起来

    原工程:https://github.com/jeekun/DownFloors 移植后的代码:HelloCpp.zip 移植后的APK:HelloCpp.apk 说明:(cocos2d-x版本是“ ...

  7. tomcat6~7~8用户设置及一个独立服务器上跑多个tomcat配置JVM设置优化亲测

    tomcat6管理用户 在tomcat `安装根目录`/conf/tomcat-users.xml

  8. 使用XAMPP和DVWA在Windows7上搭建渗透测试环境

    前言: XAMPP是一个Web应用程序运行环境集成软件包,包括MySQL.PHP.PerI和Apache的环境及Apache.MySQL.FilleZilla.Mercury和Tomecat等组件.D ...

  9. 使用WampServer和DVWA在Windows10上搭建渗透测试环境

    前言: DVWA是一个具有脆弱性的Web测试应用,需要PHP和MySQL的环境支持.我们可以手动配置DVWA所需的运行环境,也可以使用WampServer进行搭建.WampServer是集成了Apac ...

随机推荐

  1. ThreadStart 与ParameterizedThreadStart的区别

    1) ParameterizedThreadStart与ThreadStart 1 static void Main(string[] args) { #region ParameterizedThr ...

  2. 《learning hard C#学习笔记》读书笔记(19)多线程

    19.1 多线程编程知识 19.1.1 进程与线程的概念 进程: 可以理解为一块包含某些资源的内存区域,操作系统通过进程方式把它工作划分为不同的单元. 一个应用程序可以对应多个进程. 线程: 线程是进 ...

  3. javaScript事件(一)事件流

    一.事件 事件是用户或浏览器自身执行的某种动作,如click,load和mouseover都是事件的名字.事件是javaScript和DOM之间的桥梁.你若触发,我便执行——事件发生,调用它的处理函数 ...

  4. 整理:深度学习 vs 机器学习 vs 模式识别

    http://www.csdn.net/article/2015-03-24/2824301 近200篇机器学习&深度学习资料分享(含各种文档,视频,源码等) http://developer ...

  5. string,stringbuilder,stringbuffer用法

    总结:1.如果要操作少量的数据用 = String   ==================================>字符串常量2.单线程操作字符串缓冲区 下操作大量数据 = Strin ...

  6. 【Hawk】高级教程——post参数采集万方医学网论文

    目标——万方医学网论文列表 http://med.wanfangdata.com.cn/Author/General/A000000001 和普通网页不一样的地方在于点击下一页的时候,URL没有发生变 ...

  7. 一个快速排序(分类)及使用类似思想实现选择问题[c++实现]

    一.快速排序(快速分类)算法: 问题描述:给定线性集中n个元素和一个整数k,1<=k<=n,要求找出这n个元素中第k小的元素. 思想:选取数组A中的某个元素 t=A[s],然后将其他元素重 ...

  8. 【转】《从入门到精通云服务器》第六讲—OpenStack基础

    前五期的<从入门到精通云服务器>受到了广泛好评,收到留言,有很多读者对云计算相关的技术非常感兴趣.应观众要求,我们这期要安利一条纯技术内容.准备好瓜子.花生,随小编一起进入OpenStac ...

  9. HTML5 学习笔记(一)——HTML5概要与新增标签

    目录 一.HTML5概要 1.1.为什么需要HTML5 1.2.什么是HTML5 1.3.HTML5现状及浏览器支持 1.4.HTML5特性 1.5.HTML5优点与缺点 1.5.1.优点 1.5.2 ...

  10. underscorejs 源码走读笔记

    Underscore 简介 Underscore 是一个JavaScript实用库,提供了类似Prototype.js的一些功能,但是没有继承任何JavaScript内置对象.它弥补了部分jQuery ...