Table Transformers
VIVIDUS provides a set of pre-registered table transformers. Also plugins may register own table transformers (they are documented in the corresponding plugins articles).
FROM_LANDSCAPE
FROM_LANDSCAPE
transformer is designed to transform the table from a landscape form.
{transformer=FROM_LANDSCAPE}
|header 1|value 11| ... | value m1|
...
|header n|value 1n| .... |value mn|
RESOLVING_EXPRESSIONS_EAGERLY
RESOLVING_EXPRESSIONS_EAGERLY
transformer processes expressions which are used inside ExamplesTable eagerly, i.e. at the table loading stage.
If expressions generating random data are used in the table with RESOLVING_EXPRESSIONS_EAGERLY
transfomer, the random data will be generated once
and each placeholder will be replaced with this value. While in regular flow placeholders are replaced with the expression and data is generated
at step execution stage, in other words the same placeholders will be replaced by different randomly generated datasets.
{transformer=RESOLVING_EXPRESSIONS_EAGERLY}
|firstName |lastName |
|#{generate(Address.firstName)}|#{generate(Address.lastName)}|
RESOLVING_SELF_REFERENCES_EAGERLY
RESOLVING_SELF_REFERENCES_EAGERLY
transformer enables eagerly resolution of references to one column from another column within single ExamplesTable ("eagerly" means at the table loading stage). Circular references will result in error.
{transformer=RESOLVING_SELF_REFERENCES_EAGERLY}
|column1|column2 |column3 |
|A |foo<column3>bar|before<column1>after|
FORMATTING
FORMATTING
transformer formats the table according to the max width of each column. Also this transformer removes the commented lines.
{transformer=FORMATTING}
|key|
|value|
|-- |value|
|longValue|
REPLACING
REPLACING
transformer replaces all substrings inside table values with replacement according to the given parameters.
Parameter | Description |
---|---|
|
the sequence of chars to be replaced in the table cells |
|
the replacing sequence of chars |
{transformer=REPLACING, replacing=k, replacement=l}
|key |
|vakue|
SORTING
SORTING
transformer is designed to sort the table rows by the values in
the columns.
Parameter | Description |
---|---|
|
column names ordered according to the priority of applying sorting (the column names are joined using |
{transformer=SORTING, byColumns=key|key1}
|key |key1 |
|value3|value4|
|value1|value2|
ITERATING
ITERATING
transformer generates simple one-column table with header iterator
and numbers as values: 0, 1, 2… .
Parameter | Description | ||
---|---|---|---|
|
threshold value, so values are generated from 0 to ( |
||
|
value specifying which number to start generating values from, it should be less than or equal to |
||
|
threshold value specifying at which number to stop generating values, it should be greater than or equal to |
{transformer=ITERATING, startInclusive=0, endInclusive=4}
REPEATING
REPEATING
transformer generates ExamplesTable by copy-pasting the initial table the desired number of times.
Parameter | Description |
---|---|
|
the number of times to copy-paste the initial table |
The following REPEATING
transformer:
{transformer=REPEATING, times=3}
|column1|column2|
|A |C |
|B |D |
will result in the following ExamplesTable:
|column1|column2|
|A |C |
|B |D |
|A |C |
|B |D |
|A |C |
|B |D |
FILTERING
FILTERING
transformer filters the table using the specified parameters.
Parameter | Description |
---|---|
|
the maximum number of columns to keep |
|
the maximum number of rows to keep |
|
the number of random rows to keep |
|
the names of the columns to keep separated by semicolon |
|
the zero-based indices of the rows to keep separated by semicolon |
byMaxColumns and byColumnNames are competing properties and only one can be specified at the same time. The same restriction is applied to the properties byMaxRows , byRandomRows and byRowIndexes .
|
In case if byColumnNames contains nonexistent table columns the exception with list of the invalid columns will be thrown.
|
{transformer=FILTERING, byColumnNames=key1;key3, byMaxRows=1}
|key1 |key2 |key3 |
|value1|value2|value3|
|value4|value5|value6|
{transformer=FILTERING, byMaxColumns=2, byRowIndexes=0;2}
|key1 |key2 |key3 |
|value1|value2|value3|
|value4|value5|value6|
|value7|value8|value9|
{transformer=FILTERING, byColumnNames=key2;key3, byRandomRows=2}
|key1 |key2 |key3 |
|value1|value2|value3|
|value4|value5|value6|
|value7|value8|value9|
DISTINCTING
DISTINCTING
transformer generates ExamplesTable from the specified columns, deleting the rows with repeating values.
Parameter | Description |
---|---|
|
the names of the columns to keep separated by semicolon |
The following DISTINCTING
transformer:
{transformer=DISTINCTING, byColumnNames=column1;column2}
|column1|column2|column3|
|A |C |0 |
|B |D |1 |
|A |C |1 |
|A |C |0 |
|B |D |1 |
will result in the following ExamplesTable:
|column1|column2|
|A |C |
|B |D |
MERGING
MERGING
transformer merges several tables into one.
Parameter | Description |
---|---|
|
rows or columns |
|
paths to examples tables or transformers to merge |
|
value to fill new cells while merging tables with different number of rows (in |
|
{transformer=MERGING, mergeMode=rows, tables=story/tables/test1.table;story/tables/test2.table}
{transformer=MERGING, mergeMode=columns, tables=story/tables/test1.table;story/tables/test2.table;story/tables/test3.table}
{transformer=MERGING, mergeMode=columns, fillerValue=null, tables=\{transformer=FROM_EXCEL\, path=TestTemplate.xlsx\, sheet=Data\, addresses=A2\;A3\, column=test1\};\{transformer=FROM_EXCEL\, path=TestTemplate.xlsx\, sheet=Data\, range=B2:B4\, column=test2\}}
{
transformer=MERGING,
mergeMode=rows,
fillerValue=null,
tables=
\{
transformer=MERGING\,
mergeMode=columns\,
tables=
\\{
transformer=FROM_EXCEL\\,
path=TestTemplate.xlsx\\,
sheet=Data\\,
addresses=E6\\,
column=text1
\\}
\;
\\{
transformer=FROM_EXCEL\\,
path=TestTemplate.xlsx\\,
sheet=Data\\,
addresses=E7\\,
column=text2
\\}
\}
;
\{
transformer=FROM_EXCEL\,
path=TestTemplate.xlsx\,
sheet=Data\,
addresses=E8\,
column=text1
\}
}
{transformer=MERGING, mergeMode=columns, tables=/data/some-table.table}
|column1|
|value1 |
JOINING
JOINING
transformer joins values from rows/columns of the table.
Parameter | Description |
---|---|
|
rows or columns |
|
[columns mode only] name of the new column with joined values |
|
[columns mode only] colon-separated list of the columns to join |
JOINING transformer should be the last while joining columns/rows of the table which created using another transformer.
|
columns
join modeScenario: Verify JOINING transformer in default columns mode
Then `<joinedColumn>` is equal to `A B`
Examples:
{transformer=JOINING, joinMode=columns, joinedColumn=joinedColumn}
|column1|column2|
|A |B |
columns
join mode and definition of columns to joinScenario: Verify JOINING transformer in configured columns mode
Then `<joinedColumn>` is equal to `B D`
Examples:
{transformer=JOINING, joinMode=columns, joinedColumn=joinedColumn, columnsToJoin=column2;column4}
|column1|column2|column3|column4|
|A |B |C |D |
rows
join modeScenario: Verify JOINING transformer in default rows mode
Then `<column1>` is equal to `A B`
Then `<column2>` is equal to `C D`
Examples:
{transformer=JOINING, joinMode=rows}
|column1|column2|
|A |C |
|B |D |
{transformer=MERGING, mergeMode=columns, tables=
\{transformer=FROM_EXCEL\, path=/TestTemplate.xlsx\, sheet=Mapping\, range=A4:A5\, column=header1\, joinValues=true\};
\{transformer=FROM_EXCEL\, path=/TestTemplate.xlsx\, sheet=Mapping\, range=B4:B5\, column=header2\, joinValues=true\}
}
{transformer=JOINING, joinMode=columns, joinedColumn=header}
{transformer=JOINING, joinMode=columns, joinedColumn=header}
/test1.table
CARTESIAN_PRODUCT
CARTESIAN_PRODUCT
transformer creates a cartesian product from several tables.
Parameter | Description |
---|---|
|
paths to examples tables or transformers to create a cartesian product |
|
{transformer=CARTESIAN_PRODUCT, tables=story/tables/test1.table;story/tables/test2.table}
{transformer=CARTESIAN_PRODUCT, tables=/data/some-table.table}
|column1|
|value1 |
{transformer=CARTESIAN_PRODUCT, tables=\{transformer=REPEATING\, times=100\};\{transformer=FROM_CSV\, csvPath=/data/csv.csv\}}