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();
}
官方主頁:http://nunitasp.sourceforge.net/index.html
學習資源
跟自己的兄弟NUnitForms一樣,仍然沒有好的中文文檔,有興趣的朋友可以參考‘NUnitAsp的官方文檔,相對來說還是比較全的,有很多的教程。
總結
對于單元測試工具,就簡單的介紹這么多,我個人還是推薦使用TestDriven.Net的個人版,至于后面兩個NUnit的擴展,大家可以參考一下,在實際開發中用它們來測試會很麻煩,至少我目前不敢去做這個嘗試。還有一個非常值得推薦的單元測試工具Mbunit,有興趣的朋友可以關注一下,我對它了解并不多。
關于單元測試的東西也就告于段落了。
本文來自CSDN博客,轉載請標明出處:http://blog.csdn.net/sunjiakai/archive/2009/07/27/4384046.aspx
文章來源于領測軟件測試網 http://www.kjueaiud.com/