QUnitjs | JavaScript Unit Testing framework

What is 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. As of now the current release of QUnitjs is v2.9.2.

History of QUnitjs

QUnit was originally developed by John Resig as part of jQuery. In 2008 it got its own home, name and API documentation, allowing others to use it for their unit testing as well. At the time it still depended on jQuery. A rewrite in 2009 fixed that, and now QUnit runs completely standalone.

Install QUnitjs

You cna install Qunitjs by using any of below command in your local machine to test JS features.

  • NPM: npm install –save-dev qunit
  • YARN: yarn add qunit –dev
  • Bower: bower install –save-dev qunit

QUnitjs Assertions

QUnitjs Test examples

Below are some examples of QUnitjs testing framework.

QUnitjs Examples 2:

QUnitjs Examples 3:

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts: