QUnit

QUnit is JavaScript test framework, which can be used to run unit test written in JavaScript. QUnit is used by jQuery, jQuery UI, and jQuery mobile projects. QUnit was originally developed by John Resig as a part of jQuery. QUnit is normally used to test the JavaScript code and it's even used to test server-side JavaScript via some JavaScript engine such as Rhine or V8. Like we have seen in JsUnit, we can run the QUnit test in browser or in command prompt with some test runner such as Karma.

Getting started

To install QUnit in our system, we need to get the QUnit library from jQuery CDN (http://code.jquery.com/qunit/).

Two files are needed to run test with the use of QUnit: qunit.js and quint.css. Once we download these files, then we can start ...

Get Test-Driven JavaScript Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.