专栏首页张善友的专栏Mono 3.2 上跑NUnit测试

Mono 3.2 上跑NUnit测试

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

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • How does it work in Mono's C# compiler?

    Introduction Mono is an Open Source free programming language project. It is an ...

    张善友
  • VS.Net 2005 Design-Time Integration

    Introduction This article provides an overview of the VS.NET 2005 Design-Time I...

    张善友
  • 简单介绍GUI设计模式(MVP)

    看到这个题目,我估计绝大部分朋友会第一时间想到 model-view-controller ( MVC )模式。的确这个是在 GUI 设计领域里应用...

    张善友
  • SAP CRM IBASE的archive方法

    There is one IBASE 112467 which contains one object component. This IBASE is int...

    Jerry Wang
  • 『阅读源代码的姿势:以 go-restful 为例』

    谢伟
  • 阅读源代码的姿势:以 go-restful 为例

    一般初学者确定一个方向,比如web 后端、前端等,会选择一门编程语言深入下去,比如后端java、python、go等。通过项目不断练习编程语言和编程思维,知道如...

    李海彬
  • 12个Kubernetes配置的最佳实践

    到目前为止,我们大多数人都听说过人为错误,在导致数据泄露中所扮演的角色。自7月以来,Capital One发生的黑客入侵事件只是一连串安全事件中的最新一起,这些...

    CNCF
  • Codeforces Round #301 (Div. 2)(A,【模拟】B,【贪心构造】C,【DFS】)

    A. Combination Lock time limit per test:2 seconds memory limit per test:256 mega...

    Angel_Kitty
  • CoreOS 配置工具 Ignition v2.2

    This pre-release version of the specification is experimental and is subject to ...

    康怀帅
  • WashU EpiGenome Browser使用教程

    WashU EpiGenome Browser 是我用过最赞的浏览器,没有之一。希望大伙跟着教程好好学习下! 还有更多教程见:http://epigenomeg...

    生信技能树

扫码关注云+社区

领取腾讯云代金券