JsUnitTest – JavaScript Unit Testing framework
Get Version
0.7.3What
This JavaScript project provides a one-file JavaScript test suite.
This is based off unittest.js from prototypejs, except this library has no dependency on prototype.js so there is no chance your code-under-test can conflict with prototype.js or that you might accidently use a prototype.js helper for a library that will be deployed independently off prototypejs.
There is also a TextMate bundle with snippets for creating the runner and assertions.
– click to download. More information below.
Downloading
Get the latest here: jsunittest.js
Alternately, download the source for the project via the large version number box to the top-right.
Getting Started
Download tar or zip and unarchive within test/
or test/javascript
folder of your project.
The archives include the following files:
assets/jsunittest.js
assets/unittest.css
example_test.html
Once unpacked, open example_test.html
in your browser to check everything is working.
The basics
Whereever you were testing with unittest.js, drop in jsunittest.js instead (and update your <script src="../assets/unittest.js"...>
to use jsunittest.js
).
Same API as unittest.js
TextMate bundle
- Mac OSX: Download, unarchive and open with Finder to install into TextMate
- Windows (E Text Editor): Don’t know. Can someone let me know what the installation instructions are for new/update bundles?
The source for the bundle is available via git: http://github.com/drnic/javascript-unittest-tmbundle/tree/master
How to do JavaScript unit testing
- PeepCode: JavaScript Unit Testing – coming soon from Dr Nic
- newjs – started new JavaScript projects with in-built test suite
- Autotest for Javascript – ideas on a script/js_autotest script (built-in to newjs)
Contributions/Thanks:
- original unittest code – prototypejs project
- ajax library – John Resig, Pro JavaScript book
- event library – Dean Edwards
Forum
http://groups.google.com/group/drnic-javascript-projects
How to submit patches
Read the 8 steps for fixing other people’s code and for section 8b: Submit patch to Google Groups, use the Google Group above.
The source project is a Git repository. See Dr Nic’s master branch for clone/checkout details.
License
This code is free to use under the terms of the MIT license.
Contact
Comments are welcome. Send an email to Dr Nic Williams via the forum
Dr Nic Williams, 20th March 2009
Theme extended from Paul Battley