A QUnit test can contain test modules and test functions. A QUnit test module is a group of related test functions. Every test function should contain one or more assertion(s) in order to perform the test and verify the outputs.
The QUnit module
function is responsible for creating the QUnit module and the QUnit test
function is responsible for creating the QUnit test. In order to add the test function to the module, just place the test function under the declared module, as shown in the following code snippet:
module("testing Module", { setup: function() { // setup code goes here... }, teardown: function() { // teardown code goes here... } }); test("testing function1", function() { // assertions go here... }); test("testing function2", function() { // assertions go here... });
As shown in the preceding code snippet, a test module with the name "testing Module
"
is created. The test module can contain a setup
method that is called to perform...