-
Book Overview & Buying
-
Table Of Contents
Test-Driven JavaScript Development
By :
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.
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 writing our tests.
Let's see how we can write test using QUnit and know about assertions available in QUnit:
async(): Instruct QUnit to...
Change the font size
Change margin width
Change background colour