HOME

TheInfoList



OR:

QUnit is a
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
unit testing framework. Originally developed for testing
jQuery jQuery is a JavaScript library designed to simplify HTML DOM tree traversal and manipulation, as well as event handling, CSS animation, and Ajax. It is free, open-source software using the permissive MIT License. As of Aug 2022, jQuery is ...
, jQuery UI and jQuery Mobile, it is a generic framework for testing any JavaScript code. It supports
client-side Client-side refers to operations that are performed by the client in a client–server relationship in a computer network. General concepts Typically, a client is a computer application, such as a web browser, that runs on a user's local comp ...
environments in web browsers, and server-side (e.g. Node.js). QUnit's assertion methods follow the CommonJS unit testing specification, which itself was influenced to some degree by QUnit.


History

John Resig originally developed QUnit as part of jQuery. In 2008 it was extracted from the jQuery unit test code to form its 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.module(string) - Defines a module, a grouping of one or more tests. * QUnit.test(string, function) - Defines a test. QUnit uses a set of assertion method to provide semantic meaning in unit tests: * assert.ok(boolean, string) - Asserts that the provided value
casts Cast may refer to: Music * Cast (band), an English alternative rock band * Cast (Mexican band), a progressive Mexican rock band * The Cast, a Scottish musical duo: Mairi Campbell and Dave Francis * ''Cast'', a 2012 album by Trespassers William ...
to boolean true. * assert.equal(value1, value2, message) - Compares two values, using the double-equal operator. * assert.deepEqual(value1, value2, message) - Compares two values based on their content, not just their identity. * assert.strictEqual(value1, value2, message) - Strictly compares two values, using the triple-equal operator. A basic example would be as follows: QUnit.test('a basic test example', function (assert) );


See also

* List of unit testing frameworks *
Jasmine Jasmine ( taxonomic name: ''Jasminum''; , ) is a genus of shrubs and vines in the olive family ( Oleaceae). It contains around 200 species native to tropical and warm temperate regions of Eurasia, Africa, and Oceania. Jasmines are widely cult ...
*
JavaScript framework A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs. Web frameworks provide a standard way to build an ...
*
JavaScript library A JavaScript library is a library of pre-written JavaScript code that allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies. Libraries With the expanded demands for JavaScript, an e ...


References


External links

* * {{JavaScript JavaScript programming tools Unit testing frameworks Free software programmed in JavaScript