Some of the important Category of QUnit are −
Sr.No. | Category | Functionality |
---|---|---|
1 | Assert | A set of assert methods. |
2 | Async Control | For asynchronous operations. |
3 | Callbacks | When integrating QUnit into other tools such as CI servers, these callbacks can be used as an API to read the test results. |
4 | Configuration and Utilities | These methods and properties are used as utility helpers and to configure QUnit. For example, to adjust the runtime behavior directly, extend the QUnit API via custom assertions, etc. |
5 | Test | For testing operations. |
It provides a set of assert methods.
Sr.No. | Methods & Description |
---|---|
1 | async() Instruct QUnit to wait for an asynchronous operation. |
2 | deepEqual() A deep recursive comparison, working on primitive types, arrays, objects, regular expressions, dates, and functions. |
3 | equal() A non-strict comparison, roughly equivalent to JUnit's assertEquals. |
4 | expect() Specify how many assertions are expected to run within a test. |
5 | notDeepEqual() An inverted deep recursive comparison, working on primitive types, arrays, objects, regular expressions, dates, and functions. |
6 | notEqual() A non-strict comparison, checking for inequality. |
7 | notOk() A boolean check, inverse of ok() and CommonJS's assert.ok(), and equivalent to JUnit's assertFalse(). Passes if the first argument is false. |
8 | notPropEqual() A strict comparison of an object's own properties, checking for inequality. |
9 | notStrictEqual() A strict comparison, checking for inequality. |
10 | ok() A boolean check, equivalent to CommonJS's assert.ok() and JUnit's assertTrue(). Passes if the first argument is true. |
11 | propEqual() A strict type and value comparison of an object's own properties. |
12 | push() Report the result of a custom assertion. |
13 | strictEqual() A strict type and value comparison. |
14 | throws() Test if a callback throws an exception, and optionally compare the thrown error. |
It provides a set of asynchronous operations.
Sr.No. | Methods & Description |
---|---|
1 | async() Instruct QUnit to wait for an asynchronous operation. |
2 | QUnit.asyncTest() DEPRECATED: Add an asynchronous test to run. The test must include a call to QUnit.start(). |
3 | QUnit.start() PARTIALLY DEPRECATED: Start running the tests again after the testrunner was stopped. See QUnit.stop() and QUnit.config.autostart. |
4 | QUnit.stop() DEPRECATED: Increase the number of QUnit.start() calls the testrunner should wait for before continuing. |
5 | QUnit.test() Add a test to run. |
When integrating QUnit into other tools like CI servers, these callbacks can be used as an API to read the test results.
Sr.No. | Methods & Description |
---|---|
1 | QUnit.begin() Register a callback to fire whenever the test suite begins. |
2 | QUnit.done() Register a callback to fire whenever the test suite ends. |
3 | QUnit.log() Register a callback to fire whenever an assertion completes. |
4 | QUnit.moduleDone() Register a callback to fire whenever a module ends. |
5 | QUnit.moduleStart() Register a callback to fire whenever a module begins. |
6 | QUnit.testDone() Register a callback to fire whenever a test ends. |
7 | QUnit.testStart() Register a callback to fire whenever a test begins. |
These methods and properties are used as utility helpers and to configure QUnit. For example, to adjust the runtime behavior directly, extend the QUnit API via custom assertions, etc.
Sr.No. | Methods & Description |
---|---|
1 | QUnit.assert Namespace for QUnit assertions. |
2 | QUnit.config Configuration for QUnit. |
3 | QUnit.dump.parse() Advanced and extensible data dumping for JavaScript. |
4 | QUnit.extend() Copy the properties defined by the mixin object into the target object. |
5 | QUnit.init() DEPRECATED: Re-initialize the test runner. |
6 | QUnit.push() DEPRECATED: Report the result of a custom assertion. |
7 | QUnit.reset() DEPRECATED: Reset the test fixture in the DOM. |
8 | QUnit.stack() Returns a single line string representing the stacktrace (call stack). |
It provides a set of testing operations.
Sr.No. | Methods & Description |
---|---|
1 | QUnit.assert Namespace for QUnit assertions. |
2 | QUnit.asyncTest() DEPRECATED: Add an asynchronous test to run. The test must include a call to QUnit.start(). |
3 | QUnit.module() Group related tests under a single label. |
4 | QUnit.only() Adds a test to exclusively run, preventing all other tests from running. |
5 | QUnit.skip() Adds a test like object to be skipped. |
6 | QUnit.test() Adds a test to run. |