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

學(xué)習(xí)資源
        由于TestDriven.Net的使用非常簡(jiǎn)單,所以目前基本沒有什么中文文章介紹,大家可以參考一下官方網(wǎng)站上的QuickStart! 
    三.NunitForms
        NUnitForms從 命名上看,知道它跟NUnit有關(guān),沒錯(cuò),它是NUnit的一個(gè)WinFrom的擴(kuò)展。它為Windows Forms應(yīng)用程序提供單元測(cè)試和壓力測(cè)試,可以非常容易的用它為你的Windows Forms類進(jìn)行自動(dòng)化測(cè)試,它提供了一個(gè)Recorder Application,來(lái)記錄你的操作。我們編寫類似于如下代碼片斷的測(cè)試代碼:
  ButtonTester button = new ButtonTester("buttonName", "formName");
  ControlTester textBox = new ControlTester("nameOfSomeTextBox");
  Assertion.AssertEquals("defaultText", textBox["Text"];
  textBox["text"] = "newText"
        或者類似于這樣的代碼進(jìn)行操作記錄:
  //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);
  }
        對(duì)于NUnitForms,它還有一個(gè)兄弟工具叫NUnitASP,
  
    學(xué)習(xí)資源
        對(duì)于NUnitForms,仍然是沒有發(fā)現(xiàn)有好的中文資源,大家可以參考官方文檔。
  
    四.NUnitAsp
        NUnitAsp可 以說(shuō)是NUnitForms的兄弟,它也是一個(gè)NUnit的擴(kuò)展,用來(lái)自動(dòng)測(cè)試ASP.NET頁(yè)面。雖然NunitAsp可以完成一些ASP.NET頁(yè)面 的自動(dòng)化測(cè)試工作,但是在編寫測(cè)試用例的時(shí)候,如果界面上的元素比較多,編寫起來(lái)會(huì)非常的麻煩,這也是為什么NunitAsp一直處于大紫不紅的原因。它 可以編寫如下代碼片斷的測(cè)試代碼:
  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();
  }
  
    學(xué)習(xí)資源
        跟自己的兄弟NUnitForms一樣,仍然沒有好的中文文檔,有興趣的朋友可以參考‘NUnitAsp的官方文檔,相對(duì)來(lái)說(shuō)還是比較全的,有很多的教程。
  
  
    總結(jié)
        對(duì)于單元測(cè)試工具,簡(jiǎn)單的介紹這么多,我個(gè)人還是推薦使用TestDriven.Net的個(gè)人版,至于后面兩個(gè)NUnit的擴(kuò)展,大家可以參考一下,在實(shí) 際開發(fā)中用它們來(lái)測(cè)試會(huì)很麻煩,至少我目前不敢去做這個(gè)嘗試。還有一個(gè)非常值得推薦的單元測(cè)試工具M(jìn)bunit,有興趣的朋友可以關(guān)注一下,我對(duì)它了解并 不多。
        本來(lái)想在文章中再介紹一下開源的Mock框架的,感覺太多了,只好單獨(dú)放一篇文章來(lái)介紹了。
  評(píng)論:
        ?面??,可以?注一下 watiN,他可控制到 dialog/frame/js的alert/confirm 的??
  http://watin.sourceforge.net/
        ?元??的部份,我?是用 NUnitLite
  http://www.codeplex.com/NUnitLite
        功能少nunit很多-_-,但他可以?? web site project ?app_code?的cs
        符合工作的需求,也可?考看看
        對(duì)于Mobile的單元測(cè)試工具,恐怕很難找,因?yàn)閚etcf對(duì)于反射支持有限,而像NUnit這樣的工具也用到了反射。典型的例子是NDoc,這個(gè)對(duì)netcf有的時(shí)候愛莫能助了
  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. "
        免費(fèi)但不是開源的...
  http://www.jetbrains.com/unitrun/
        VS2007 將支持Mobile 系統(tǒng)的 unit test, 請(qǐng)大家關(guān)注。
        另外, VS2005 database professsional 版本已經(jīng)發(fā)布,支持SQL的單元測(cè)試 ,請(qǐng)大家試用。

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