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. 解决MVC4 时间验证Bug

    MVC验证时间控件(my97,时间格式:yyyy-MM-dd HH:mm:ss)  在谷歌浏览器上一切正常.但在火狐和IE 上一直验证不通过 (错误信息:日期格式不对) 猜想是 时间格式的问题..日期 ...

  2. Officel常用操作

    Excel: 1.隔行变色|菜单->条件格式->其它规则->使用公式->"=MOD(ROW(),2)=0" 2.查找包含特定字符的单元格,并替换整个单元格 ...

  3. 5款强大的Java Web开发工具

    1.WebBuilder这是一款开源的可视化Web应用开发和运行平台.基于浏览器的集成开发环境,采用可视化的设计模式,支持控件的拖拽操作,能轻松完成前后台应用开发:高效.稳定和可扩展的特点,适合复杂企 ...

  4. Android下的屏幕适配

    1080 100dp 300px720 100dp 200px 300px 1080px 比例是300/1080=0.277200px 720px

  5. 转: Delphi的OverRide、OverLoad和Virtual方法

    http://blog.csdn.net/ckli/article/details/2201418 override 重写 也叫覆盖 .方法的重写Overriding和重载Overloading是Ja ...

  6. js 实现表格的可编辑状态

    实现表格的可编辑,点击修改以后可以编辑,代码如下: <!DOCTYPE HTML> <html> <head> <meta charset="utf ...

  7. 写给Git初学者的7个建议

    [原文] - http://blog.jobbole.com/50603/ 当我刚刚开始使用Git的版本控制时,我根本不确定我付出那么多时间是不是会得到回报.Branch.Stage.Stash,这些 ...

  8. 通过GDI+绘制 验证码

    只为了记录下自己的学习历程,方便日后查看 现在开始言归正传,以下为其完整代码附上 using System; using System.Collections.Generic; using Syste ...

  9. mac osx Forbidden You don't have permission to access / on this server解决方法

    (1)首先查看*.conf 是否有读写权限,如果没有要将文件赋予读写权限,比如 localhost.conf (2)再查看/Users/username/Sites/localhost/文件夹是否有i ...

  10. 使用C#在CEF中拦截并响应请求

    一.前言 忙里偷闲,研究了一下如何在CEF中拦截请求,并作出响应.这个功能对某些需要修改服务器响应的需求来说必不可少,可以直接读取本地文件作为响应内容. C#的CEF封装项目有很多,我使用的是Chro ...