QUnit


QUnit is a JavaScript unit testing framework. Originally developed for testing jQuery, jQuery UI and jQuery Mobile, it is a generic framework for testing any JavaScript code. It supports client-side environments in web browsers, and server-side.
QUnit's assertion methods follow the CommonJS unit testing specification, which itself was influenced to some degree by QUnit.

History

QUnit was originally developed by John Resig as part of jQuery. In 2008 it was extracted from the jQuery unit test source code to form its own project and became known as "QUnit". This allowed others to start using it for writing their unit tests. While the initial version of QUnit used jQuery for interaction with the DOM, a rewrite in 2009 made QUnit completely standalone.

Usage and examples

QUnit uses a set of assertion method to provide semantic meaning in unit tests:
A basic example would be as follows:

QUnit.test;