Data
Data
section is separated into three sub-sections:
Selections
This section is optional and in depends on the specific case but here we can specify list of selections that should be applied before each test is ran.
Note
Before each test clearAll
is called! To change this behavior checkout the Options
section below
In general the selections here are defined in the same manner as the global placeholder selections.
There are couple of additions though:
Bookmarks
Here we can add bookmarks as part of our selections list by providing the bookmarks names:
1 2 3 4 5 6 7 |
|
ByName
We can also reference the global placeholder selections (defined in the global placeholder section) and they will be applied:
1 2 3 4 5 6 7 |
|
State
For each selection alternate state can be defined. This includes the placeholder selections. When defining placeholder selections is not possible to set state. State for placeholder selections can be specified when these selections are referenced (aka actually used)
Note
If no state is specified then the default ($) state will be used
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
Note
Its not possible to provide state when using bookmarks
Options
Small optional section used to set some test suite options:
skip
- if true then the whole test suite will not be ranclearAllBeforeEach
- default istrue
. If set tofalse
thenclearAll()
will not be called before each test is executed
Tests
This section is the actual part where developers might spend most of their time. In this section all data tests are defined.
Each test can be logically split into three sections:
Generic
- name - short description of the test
- description - optional field to provide more information about the test
- type -
scalar
orlist
(more on this below) - skip - default
true
. If set tofalse
the test will not be ran
Selections
Define test specific selections that will be made before the data tests is evaluated. This sections is defined in the same way as test suite selections
Details
And at the end all is about this section.
At the moment two test types are supported:
Scalar
This the very basic and possibly most used test type. It's just a single expression. Check out the example below.
- expression - It can be any Qlik expression. The value in this field is passed as it is to Qlik engine to be evaluated
- result - what should be the expected result. This can also be an expression
- operator - one of
<
,>
,>=
,<=
,==
,!=
,=
,<>
. The result ofexpression
will be compared withresult
based on the operator. - state - optional field to define in which state the expression will be evaluated
List
This test type is to validate if values in specific field are present or missing after some selections are made. Will agree that this is not very "interesting" test scenario but it can be useful in some cases
- fieldName - name of the field
- values - array of values
- operator - one of
present
ormissing
- state - optional field to define in which state the list will be evaluated
Variations
Each expected result can be flagged as passed if the calculation result is in some variation/tolerance from from the expected result.
For example: - calculation returns 110
- expected result 100
- the test is passed if the calculation result is within +-5%
of the expected result
In the example above the test will be passed if the calculation result is between 95
and 105
.
Possible variations:
+-NUMBER
NUMBER
(same as+NUMBER
)-NUMBER
+-NUMBER%
NUMBER%
(same as+NUMBER%
)-NUMBER%
Note
More variation options are planned. Such as using an expressions.
Full example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|