JavaScript 测试框架 - wru

jopen 13年前

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 no with statements, eval, or misused this references
  • easy, probably the easiest way to test JS code out there thanks to its simplified API: test, assert, async, and log ... 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 = ... or Object.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

项目主页:http://www.open-open.com/lib/view/home/1331393265171