• 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

  • 相关阅读:
    2331: [SCOI2011]地板 插头DP
    APIO2018 铜滚记
    2827: 千山鸟飞绝 非旋treap
    3682: Phorni 后缀平衡树 线段树
    4712: 洪水 基于链分治的动态DP
    20180507小测
    4923: [Lydsy1706月赛]K小值查询 平衡树 非旋转Treap
    5312: 冒险 线段树 复杂度分析
    5210: 最大连通子块和 动态DP 树链剖分
    4513: [Sdoi2016]储能表 数位DP
  • 原文地址:https://www.cnblogs.com/shanyou/p/3231398.html
Copyright © 2020-2023  润新知