JsUnitTest – JavaScript Unit Testing framework

Get Version

0.7.3

What

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.

Logo Bundle – 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

Passing Prototypejs Unittest Tests

TextMate bundle

Logo Bundle – click to download

The source for the bundle is available via git: http://github.com/drnic/javascript-unittest-tmbundle/tree/master

How to do JavaScript unit testing

Contributions/Thanks:

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