顯示具有 Test 標籤的文章。 顯示所有文章
顯示具有 Test 標籤的文章。 顯示所有文章

星期六, 3月 22, 2008

Nunit中避免category寫錯的小技巧

一般category的使用方式如下:

[Test, Category("IntegrationTest")]
void Test1(){.....}

----------------

一個避免寫錯與免記憶負擔的技巧:

建立一個namespace,內含一些class,用來表示所有測試的category:

namespace TestCategory
{
    class UnitTest : CategoryAttribute { }

    class IntegrationTest : CategoryAttribute { }
}

使用方式:

[Test, TestCategory.IntegrationTest]
void Test1(){.....}

星期一, 6月 04, 2007

如何不被 TortoiseSVN 拖慢系統效率 [JeffHung.Blog]

用了TortoiseSVN後系統似乎變慢了,以下文章說明如何增進系統效能:

* 如何不被 TortoiseSVN 拖慢系統效率 [JeffHung.Blog]
* Optimize Performance

星期三, 2月 28, 2007

好的Test具備好的可度性

Test Double

MF Bliki: TestDouble

在Martin Fowler的網站上看到一篇文章,題中提到一些人對於Mock或Stub之類的物件有著各式各樣的說明。Gerard Meszaros試圖替這些相關的用詞訂出明確的定義,Gerard將這些類似用途的物件統稱為Double,然後又分成以下四類:
  • Dummy objects are passed around but never actually used. Usually they are just used to fill parameter lists.
  • Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production (an InMemoryDatabase is a good example).
  • Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what's programmed in for the test. Stubs may also record information about calls, such as an email gateway stub that remembers the messages it 'sent', or maybe only how many messages it 'sent'.
  • Mocks are pre-programmed with expectations which form a specification of the calls they are expected to receive. They can throw an exception if they receive a call they don't expect and are checked during verification to ensure they got all the calls they were expecting.

星期一, 2月 19, 2007

Selenium Remote Control初體驗

今日首次使用Selenium Remote Control來測試網頁,感覺不錯,不過仍然遭遇到一些問題,還好最後都解決了。
  • 問題一: 連不上Selenium Server
    原本以為是被防火牆擋住了,弄了半天都沒辦法解決。後來才發現是VPN搞的鬼,關掉VPN就可以正常連線了。
  • 問題二: 無法下達type指令
    一直無法成功鍵入"cmd=type&1=question&2=This is a test&sessionId=1234"指令,總是回傳exception。開啟Selenium在瀏覽器端的log視窗也看不出什麼端倪。最後才發現原來是我耍白爛,在我所測試的網頁中,id question的控制項其實是個combo box,而我想測試的text box的id其實是txtquestion。因此只要將指令改成"cmd=type&1=txtquestion&2=This is a test&sessionId=1234"即可正常執行。
  • 問題三: 無法利用type指令送出中文
    直接送入中文, 如"cmd=type&1=txtquestion&2=馬英九", 會在瀏覽器端看到亂碼。如果將"馬英九"在utf8下編碼成url的%編碼 (%e9%a6%ac%e8%8b%b1%e4%b9%9d),就能在瀏覽器端正常收到"馬英九"三個字

星期一, 1月 01, 2007

軟體測試工具

自動化使用者介面測試工具


自動化Acceptance Test工具

  • Fit: 讓客戶能夠以Word之類的表格來撰寫測試範例,同時又能夠讓開發者的程式自動測試這些範例
C++測試工具

軟體測試的分類

從測試內容與實作細節有沒有關係來做區分:


  • White-Box Test: 測試內容只與軟體介面有關
  • Black-Box Test: 測試內容除了與軟體介面有關之外,還與特定實作有關

從測試的層級來區分(單一開發者-->多開發者-->專案-->客戶)

  • Unit Test: 測試單一元件
  • Integration Test: 測試多個元件
  • System Test: 測試整個系統
  • Acceptance Test: 測試客戶需求
    • Alpha Test: 公司內部模擬客戶來測試需求
    • Beta Test: 由實際客戶來進行測試

從目的來定義

  • Regression Test:
    根據Wikipedia:
    • 任何用來發掘regression bugs的測試都叫做regression test
      (Regression testing is any type of software testing which seeks to uncover regression bugs)
    • 當原先正常功能後來被改壞掉時,我們稱之產生了一個regression bug
      (Regression bugs occur whenever software functionality that previously worked as desired stops working or no longer works in the same way that was previously planned)