您的位置:軟件測試 > 開源軟件測試 > 開源軟件測試解決方案 > 開源測試工具組合
NET開源項目介紹及資源推薦
作者:網(wǎng)絡(luò)轉(zhuǎn)載 發(fā)布時間:[ 2013/12/12 10:22:02 ] 推薦標簽:

學習資源
        由于TestDriven.Net的使用非常簡單,所以目前基本沒有什么中文文章介紹,大家可以參考一下官方網(wǎng)站上的QuickStart! 
    三.NunitForms
        NUnitForms從 命名上看,知道它跟NUnit有關(guān),沒錯,它是NUnit的一個WinFrom的擴展。它為Windows Forms應(yīng)用程序提供單元測試和壓力測試,可以非常容易的用它為你的Windows Forms類進行自動化測試,它提供了一個Recorder Application,來記錄你的操作。我們編寫類似于如下代碼片斷的測試代碼:
  ButtonTester button = new ButtonTester("buttonName", "formName");
  ControlTester textBox = new ControlTester("nameOfSomeTextBox");
  Assertion.AssertEquals("defaultText", textBox["Text"];
  textBox["text"] = "newText"
        或者類似于這樣的代碼進行操作記錄:
  //records button.Click() public void Click(object sender, EventArgs args){
  listener.FireEvent(TesterType, sender, "Click");
  }//records: comboBox.Enter("text"); public void TextChanged(object sender, System.EventArgs e){
  listener.FireEvent(TesterType, sender, "Enter", ((ComboBox)sender).Text);
  }//records: comboBox.Select(3); //text of item 3 public void SelectedIndexChanged(object sender, System.EventArgs e){
  EventAction action = new EventAction("Select", ((ComboBox)sender).SelectedIndex);
  action.Comment = ((ComboBox)sender).Text;
  listener.FireEvent(TesterType, sender, action);
  }
        對于NUnitForms,它還有一個兄弟工具叫NUnitASP,
  
    學習資源
        對于NUnitForms,仍然是沒有發(fā)現(xiàn)有好的中文資源,大家可以參考官方文檔。
  
    四.NUnitAsp
        NUnitAsp可 以說是NUnitForms的兄弟,它也是一個NUnit的擴展,用來自動測試ASP.NET頁面。雖然NunitAsp可以完成一些ASP.NET頁面 的自動化測試工作,但是在編寫測試用例的時候,如果界面上的元素比較多,編寫起來會非常的麻煩,這也是為什么NunitAsp一直處于大紫不紅的原因。它 可以編寫如下代碼片斷的測試代碼:
  public void TestLayout(){
  TextBoxTester name = new TextBoxTester("name", CurrentWebForm);
  TextBoxTester comments = new TextBoxTester("comments", CurrentWebForm);
  ButtonTester save = new ButtonTester("save", CurrentWebForm);
  DataGridTester book = new DataGridTester("book", CurrentWebForm);
  Browser.GetPage("http://localhost/GuestBook/GuestBook.aspx");
  AssertVisibility(name, true);
  AssertVisibility(comments, true);
  AssertVisibility(save, true);
  AssertVisibility(book, false);
  }public void TestSave(){
  TextBoxTester name = new TextBoxTester("name", CurrentWebForm);
  TextBoxTester comments = new TextBoxTester("comments", CurrentWebForm);
  ButtonTester save = new ButtonTester("save", CurrentWebForm);
  DataGridTester book = new DataGridTester("book", CurrentWebForm);
  Browser.GetPage("http://localhost/GuestBook/GuestBook.aspx");
  name.Text = "Dr. Seuss" comments.Text = "One Guest, Two Guest! Guest Book, Best Book!" save.Click();
  }
  
    學習資源
        跟自己的兄弟NUnitForms一樣,仍然沒有好的中文文檔,有興趣的朋友可以參考‘NUnitAsp的官方文檔,相對來說還是比較全的,有很多的教程。
  
  
    總結(jié)
        對于單元測試工具,簡單的介紹這么多,我個人還是推薦使用TestDriven.Net的個人版,至于后面兩個NUnit的擴展,大家可以參考一下,在實 際開發(fā)中用它們來測試會很麻煩,至少我目前不敢去做這個嘗試。還有一個非常值得推薦的單元測試工具Mbunit,有興趣的朋友可以關(guān)注一下,我對它了解并 不多。
        本來想在文章中再介紹一下開源的Mock框架的,感覺太多了,只好單獨放一篇文章來介紹了。
  評論:
        ?面??,可以?注一下 watiN,他可控制到 dialog/frame/js的alert/confirm 的??
  http://watin.sourceforge.net/
        ?元??的部份,我?是用 NUnitLite
  http://www.codeplex.com/NUnitLite
        功能少nunit很多-_-,但他可以?? web site project ?app_code?的cs
        符合工作的需求,也可?考看看
        對于Mobile的單元測試工具,恐怕很難找,因為netcf對于反射支持有限,而像NUnit這樣的工具也用到了反射。典型的例子是NDoc,這個對netcf有的時候愛莫能助了
  ReSharper UnitRun
  "is a free add-in for Microsoft Visual Studio 2005 that allows you to automatically run and profile unit tests. This user-friendly tool detects test fixtures of the supported unit testing frameworks and lets you run or profile them right from the code editor or from Visual Studio's Solution Explorer. "
        免費但不是開源的...
  http://www.jetbrains.com/unitrun/
        VS2007 將支持Mobile 系統(tǒng)的 unit test, 請大家關(guān)注。
        另外, VS2005 database professsional 版本已經(jīng)發(fā)布,支持SQL的單元測試 ,請大家試用。

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