您的位置:軟件測試 > 開源軟件測試 > 開源單元測試工具 > Nunit
Visual Studio 2010 Ultimate敏捷測試驅(qū)動開發(fā)
作者:網(wǎng)絡(luò)轉(zhuǎn)載 發(fā)布時間:[ 2013/4/2 14:21:41 ] 推薦標簽:

  添加一個unit新類Collection.cs,加入一下代碼:
  private string label;
  private Uri uri;
  public Collection(string label, Uri uri)
  {
  this.label = label;
  this.uri = uri;
  }
  public string Label
  {
  get
  {
  return label;
  }
  }
  public Uri Uri
  {
  get
  {
  return uri;
  }
  }

  替換Collections.Add()方法,修改Count屬性返回count變量值。
  ///
  /// 增加一個Count實例變量
  ///
  public void Add(Collection collction)
  {
  count++;
  }

  再次生成這個項目,輸出結(jié)果顯示成功,如圖12所示。

圖12 輸出單元測試成功結(jié)果

  再次重復(fù)上面操作,創(chuàng)建一個版本擱置。

  4.確認測試(BVT)

  生成確認測試(BVT)是通過產(chǎn)生測試列表來檢查軟件,它通常作為一個生成任務(wù)在團隊生成結(jié)束的時候執(zhí)行。當編寫好一個unit測試時,你可以加入到BVT中,確保任何時候在生存庫環(huán)境下運行集成生成,相同的測試程序都可以依次執(zhí)行。

  我們可以把上面的EmptyCollctionsCountShouldBeZero()和EmptyCollctionsCountShouldIsOne()測試方法創(chuàng)建生成測試。打開Microsoft Visual Studio 2010菜單,點擊Test|Windows,如圖13所示。

圖13 Test|Windows菜單

  點擊菜單項Test|Windows|Test List Editor,打開Test List Editor界面,如圖14所示。

圖14 Test List Editor界面

上一頁123456下一頁
關(guān)鍵詞閱讀
軟件測試工具 | 聯(lián)系我們 | 投訴建議 | 誠聘英才 | 申請使用列表 | 網(wǎng)站地圖
滬ICP備07036474 2003-2017 版權(quán)所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd