首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Mono 3.2 上跑NUnit测试

Mono 3.2 上跑NUnit测试

作者头像
张善友
发布2018-01-19 14:22:35
6330
发布2018-01-19 14:22:35
举报
文章被收录于专栏:张善友的专栏张善友的专栏

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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2013-08-01 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档