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. ****基于H5的微信支付开发详解[转]

    这次总结一下用户在微信内打开网页时,可以调用微信支付完成下单功能的模块开发,也就是在微信内的H5页面通过jsApi接口实现支付功能.当然了,微信官网上的微信支付开发文档也讲解的很详细,并且有实现代码可 ...

  2. ppmoney

    build/config.js 改 8080端口 build/webpack.dev.conf.js 改路径简写 alias:{ 'vux-components':'vux/dist/componen ...

  3. 第三十三篇:使用uiresImporter生成uires.idx及skin.xml

    在SOUI中,使用uires.idx这个文件来记录程序中使用的所有资源文件. 此外绘制对象(ISkinObj)则一般放在skin.xml中描述. 要向一个界面中增加一个新的图片,在没有uiresImp ...

  4. 使用 ApacheBench 进行轻量级压力测试

    ApacheBench 是 Apache Http Server 附带的一个轻量级压力测试功能 先下载一个Apache Http Server :http://httpd.apache.org/ 解压 ...

  5. web.xml文件加载顺序

    1.启动一个WEB项目的时候,WEB容器会去读取它的配置文件web.xml,读取<listener>和<context-param>两个结点. 2.紧急着,容创建一个Servl ...

  6. idapython实现动态函数调用批量注释

    部门小伙伴遇到一个样本需要对动态函数调用就行批量注释还原的问题,通过idapython可以大大的减少工作量,其实这一问题也是很多样本分析中最耗时间的一块,下面来看看如何解决这个问题(好吧这才是今年最后 ...

  7. js转换数据库中DateTime字段类型

    在程序中,从数据库中读取到的日期时间类型数据一般是这种格式:"/Date(1355109408000+0800)/" 要经过js函数处理变为格式:'2012-12-10 11:05 ...

  8. 《转》Unity3D研究院编辑器之5.3JSON的序列化

    Unity5.3 的一项新功能就是Json的序列化,支持嵌套使用,可以把json字符串转成对象,把对象转成json字符串. using UnityEngine; using UnityEditor; ...

  9. 该不该在C#中使用var关键词

    作为一个并不勤快的程序猿,在项目开发过程中总是想尽办法少写代码,对var关键词的使用自然不会放过,几乎在每个能使用var的地方都用了var,对此,很多朋友同事给出了不同的建议,觉得能不使用var关键词 ...

  10. jquery事件核心源码分析

    我们从绑定事件开始,一步步往下看: 以jquery.1.8.3为例,平时通过jquery绑定事件最常用的是on方法,大概分为下面3种类型: $(target).on('click',function( ...