JavaScript 測試框架 - wru
wru 是一個必不可少,通用的測試框架,兼容 node.js, Rhino, PhantomJS 等Web環境。它擁有以下特性:
- runs in both client and server environments, compatible with html files, node.js, Rhino, and PhantomJS
- both synchronous and asynchronous tests in an absolutely intuitive way
- ES5 and JS.next ready, compatible with
"use strict"
directive which means nowith
statements,eval
, or misusedthis
references - easy, probably the easiest way to test JS code out there thanks to its simplified API:
test
,assert
,async
, andlog
... you already remember "all of them", isn't it? - unobtrusive and self defensive, since everything that could possibly change in such dynamic environment as JS is, is "sandboxed" inside the wru closure. This means no matter how "nasty" your code is, wru won't pollute or change the global environment, neither it will rely in native constructor.prototypes changes (
Array.prototype.push = ...
orObject.prototype.hasOwnProperty = ...
? not a problem!) - cursor included in both web and console ... you gonna realize how much "THE CURSOR" is important, specially to understand if your test is stuck or simply "waiting for" ... cursor is working in both Unix and OSX consoles (unfortunately PhantomJS does not support the cursor)
- tiny, even if it's not important in tests world, wru fits into about 2Kb (1.2Kb minzpped) which means not much to fix or change here, just a simple, reliable, and essential framework for your tests
- under your control, since there is absolutely no magic behind the wru scene. You assert what you want, you async what you need, you describe what's needed, and you are ready to go in less than 5 minutes </ul>
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!