This page looks plain and unstyled because you're using a non-standard compliant browser. To see it in its best form, please visit upgrade to a browser that supports web standards. It's free and painless.

Fillano's Learning Notes 會員登入 會員註冊

在John Resig的blog上看到的,簡單好用的單元測試工具。作者就是......他自己。

 

條列一下幾個簡單的用法說明:

  • fireunit.ok(Boolean, '測試說明')
    (簡單測試,第一個參數是true時測試結果成功,false時測試失敗。第二個參數是測試的說明。)
  • fireunit.compare(預期結果, 實際結果, '測試說明')
    (比較預期結果與實際結果是否相同,第三個參數是測試的說明。)
  • fireunit.reCompare(預期結果, 實際結果, '測試說明')
    (與compare差不多,但是預期結果是用Regular Expression來表示,所以結果用RE比較是符合的就可通過測試)
  • fireunit.testDone()
    (測試完畢,產生測試結果)

 (閱讀全文)