This plugin provides ability to specify the list of test cases outside of the test function. When list of test cases is provided then separated test is added to run per each test case. Test case is passed to test function as parameter.
Benefits are:
QUnit ;Given test function is:
{ return a + b; }Then the following code:
QUnit ;is eqivalent to:
QUnit;QUnit;QUnit;Since v0.4 test fails when empty test cases set (or null or undefined) is provided. See Issue#4 for details.
Parameter assert is provided as the second parameter to the test function.
QUnit ;When special parameter 'title' is specifies in test case then test case title is added as suffix to the test title.
The following code:
QUnit ;is equivalent to:
QUnit;QUnit;(available since v0.2)
For running several tests over the same test data.
QUnit ;(available since v0.3)
Test cases can be generated based on provided test data.
Generates the set of test cases based on provided pairs of test data.
The following code
QUnit ;Is equivalent to:
QUnit ;The total count of test cases is the maximum count of cases from 'cases()' and 'sequential()'.
When some test case should be skipped then 'null' or 'undefined' can be passed at its place:
The following code
QUnit produces test cases:
a : 1 b : "one" a : 2 a : null b : "null" Generates the test cases combinations based on provided test data.
The following code
QUnit produces test cases:
a : 1 b : "X" a : 1 b : "Y" a : 2 b : "X" a : 2 b : "Y" When 'null' or 'undefined' is passed as test data then original test case is not changed:
The following code
QUnit produces test cases:
a : 1 b : "X" a : 1 a : 2 b : "X" a : 2 If parameter with the same name is presented in both 'cases()' and in 'sequential()/combinatorial()' then value from 'cases()' is prefered to generate resulting test case:
The following code
QUnit produces test cases:
a : 1 a : 2 If parameter 'title' is presented in both 'cases()' and in 'sequential()/combinatorial()' then resulting 'title' value is a concatenation of both original values:
The following code
QUnit produces test cases:
title : "case1 mix1" a : 1 b : "X" title : "case1 mix2" a : 1 b : "Y" title : "case2 mix1" a : 2 b : "X" title : "case2 mix2" a : 2 b : "Y" It is possible to apply multiple 'sequential()/combinatorial()' calls to the same test cases set.
QUnit