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. [BI项目记]-TFS Express备份和恢复

    在项目中对TFS进行备份操作是日常重要的工作之一,此篇主要描述如何对TFS Express进行备份,并且在另外一台服务器上进行恢复. 以下是操作的几个关键点: 备份数据库,在TFS管理工具中就可以完成 ...

  2. C++ 系列:继承

    Copyright © 1900-2016, NORYES, All Rights Reserved. http://www.cnblogs.com/noryes/ 欢迎转载,请保留此版权声明. -- ...

  3. 攻城狮在路上(陆)-- 提交运行MapReduce程序到hadoop集群运行

    此种方式不能直接在eclipse中调试代码. 首先需要在src下放置服务器上的hadoop配置文件:core-site.xml\yarn-site.xml\hdfs-site.xml\mapred-s ...

  4. Python帮助文档中Iteration iterator iterable 的理解

    iteration这个单词,是循环,迭代的意思.也就是说,一次又一次地重复做某件事,叫做iteration.所以很多语言里面,循环的循环变量叫i,就是因为这个iteration. iteration指 ...

  5. [转]js实现各种进制的转换

    关键点: parseInt(string, radix).toString(target_radix); 参考:http://www.cnblogs.com/guowei1027/archive/20 ...

  6. 没有了SA密码,无法Windows集成身份登录,DBA怎么办?

    一同事反馈SQL无法正常登录了,以前都是通过windows集成身份验证登录进去的(sa密码早忘记了),今天就改了服务器的机器名,现在无论如何都登录不进去. SQL登录时如果采用windows集成身份验 ...

  7. Spring集成JUnit测试

    1.程序中有Junit环境2.导入一个jar包.spring与junit整合jar包 spring-test-3.2.0.RELEASE.jar3.测试代码 @RunWith(SpringJUnit4 ...

  8. 关于安装Apache之后,解析PHP的配置

    需要配置四个地方 LoadModule php5_module modules/libphp5.soServerName localhost:80DirectoryIndex index.phpAdd ...

  9. redis——学习之路五(简单的C#使用redis)

    redis官方推荐使用的客户端程序 打星星表示推荐使用的客户端程序,一个笑脸表示最近6个月内有过正式活动的.http://redis.io/clients/#c 从这里我们可以判断官方推荐我们使用Se ...

  10. npm淘宝镜像cnpm

    npm install -g cnpm --registry=https://registry.npm.taobao.org