• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 掌握單元測試工具Nunit基本用法[2]

    發表于:2010-03-30來源:作者:點擊數: 標簽:工具單元nunitNUnitNunit
    掌握單元測試工具 Nunit 基本用法[2] 單元測試工具 7. NUnit的框架 使用NUint框架的最小要求 using NUint.Framework; [TestFixture] public class TestSimple { [Test] public void TestMethod() { Assert.AreEqual(2, 4/2); } } 1)需要NUint.Framework的命

      掌握單元測試工具Nunit基本用法[2]   單元測試工具 

         7. NUnit的框架

      使用NUint框架的最小要求

      using NUint.Framework;

      [TestFixture]

      public class TestSimple

      {

      [Test]

      public void TestMethod()

      {

      Assert.AreEqual(2, 4/2);

      }

      }

      1)需要NUint.Framework的命名空間,項目中需要引用NUint.dll;

      2)每個包含測試的類都必須帶TestFixture屬性標記,且這個類必須是public的。

      [NextPage]

      3)測試類包含的所有帶Test屬性標記的public方法都會被NUint自動執行。

      8.NUint的分類Categories

      用Category的概念提供了標記和運行一個個單獨的測試和TestFixture的簡單方法。

      一個Category是自己定義的一個名字??砂巡煌?STRONG>測試方法關聯到一個或多個Category,然后運行測試的時候選擇自己想要運行的Category。

      如,實際中有些測試只需幾秒就能完成,而有些則須長時間才能完成,為了避免每次都執行長時間的測試,可使用分類來標記它們,然后運行測試指定需要運行的Category。

      [Test]

      [Category("Short")]

      public void ShortTest()

      {

      //do some tests.

      }

      [Test, Category("Long")] //兩種屬性的寫法就可以

      public void LondTest()

      {

      //do some tests.

      }

      同樣,有時需要:當沒有明確選擇任何Category時,希望某些Category的測試能夠被運行;而當顯示選擇一些Category時,則只有被選擇的Category才會被執行。軟件測試

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>