Skip to content

Commit

Permalink
Add documentation for #444, #464 and #467
Browse files Browse the repository at this point in the history
  • Loading branch information
Cédric L. Charlier committed Mar 25, 2019
1 parent 1c70b65 commit cf32fc7
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 5 deletions.
43 changes: 41 additions & 2 deletions _documentation/primitive-result-set.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ The most straightforward is to define rows and cells inline. This is relatively

### External definition

You can also refer to an external CSV file:
You can also refer to an external flat file. By default, flat files are considered as CSV with a field-separator set to a semi-column (*;*) and a record-separator set to carriage return/line feed (*CrLf*) and no quoting character. You can edit this default format as explained in [this section](../config-profile-csv/).

{% highlight xml %}
<result-set file="myFile.csv"/>
{% endhighlight %}

the filename can be dynamically evaulated based on a variable (formatting). To enable this feature, you must precede the filename by a tilt ```~``` and mix static part of the filename with dynamic part. The dynamic part must be contained between curly barces ```{}``` and start by the variable name to consider.
the filename can be dynamically evaluated based on a variable (formatting). To enable this feature, you must precede the filename by a tilt ```~``` and mix static part of the filename with dynamic part. The dynamic part must be contained between curly barces ```{}``` and is starting by the variable's name to consider.

{% highlight xml %}
<result-set file="File_{@myVar}.csv"/>
Expand All @@ -54,6 +54,45 @@ Using the previous notation, if the value of *myVar* is *1st January 2018* then

The formatting syntax is the one supported by .Net and explained in MSDN for the [numerics](https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings) and [dateTimes](https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings)

You can also use the long version to reference an external flat file:
{% highlight xml %}
<result-set>
<file>
<path>File_{@myDate:yyyy}_{@myDate:MM}.csv"</path>
</file>
</result-set>
{% endhighlight %}

#### if-missing directive

If the mentionned file is not available, by default, the test will throw an error stating that a dependency has not been found. It's possible to override this behaviour and specify that when the file is missing, you should take a look to another location. This is a recurrent statement, so it's possible to define a thrid place to use when the two first are not available and so on.

{% highlight xml %}
<result-set>
<file>
<path>File_{@myDate:yyyy}_{@myDate:MM}.csv"</path>
<if-missing behaviour="redirect">
<file>
<path>AnotherFile_{@myDate:yyyy}_{@myDate:MM}.csv"</path>
</file>
</if-missing>
</file>
</result-set>
{% endhighlight %}

#### Custom parser

If you need you can also define a custom parser. More information are available at [this page](../extension-flatfile/).

{% highlight xml %}
<result-set>
<file>
<path>File_{@myDate:yyyy}_{@myDate:MM}.csv"</path>
<parser name="opendata"/>
</file>
</result-set>
{% endhighlight %}

### Sequences-based definition

You can define a result-set as the combination of one or more sequences. Each sequence creates a new column in the result-set. The resulting rows' count is depending on the combination type. Currently, the only combination-type supported is a *cartesian-product*. The *cartesian-product* will create one row for each combination of the different elements of the two sequences.
Expand Down
2 changes: 1 addition & 1 deletion _documentation/primitive-scalar.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The value of the scalar is identical the value of the variable. It could be a gl

#### Inline transformations

From time to time, you'll need to use a variable and slightly transform it to get what you really want. Defining additional variables, supporting these transformations, has a negative impact on readiness of your test-suite. You can achieve the same result with inline transformations.
From time to time, you'll need to use a variable and slightly transform it to get what you really want. Defining additional variables, supporting these transformations, has a negative impact on readiness of your test-suite. You can achieve the same result with inline transformations. The list of transformations supported is defined at [this page](../transform-column#Native).

Inline transformations make usage of a pipe ```|``` to list them. They are applied from left to right and the result of the previous evaluation is always the input of the next evaluation.

Expand Down
14 changes: 12 additions & 2 deletions _documentation/primitive-sequence.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The easiest way to define a sequence is to specify each member. This can be done

### Sentinel loops

Usage of a *loop-sentinel* element is targetting the definition of sequence containing elements developed one by one with the help of a recursive calculation. The first element is the defined by the *seed* attribute and is always returned by the loop (meaning that a loop-sentinel has a minimum of one element). The next element of the sequence is calculated based on the seed and the addition of the *step* attribute. The third element will be calculated based on the second and the step. The sequence is over when the next element is greater or equal to the *terminal* attribute.
Usage of a *loop-sentinel* element is targetting the definition of sequence containing elements developed one by one with the help of a recursive calculation. The first element is defined by the *seed* attribute and is always returned by the loop (meaning that a loop-sentinel has a minimum of one element). The next element of the sequence is calculated based on the seed and the addition of the *step* attribute. The third element will be calculated based on the second element and the step. The sequence is over when the next element is greater than the *terminal* attribute.

{% highlight xml %}
<sequence type="dateTime">
Expand All @@ -40,4 +40,14 @@ Expl:

Due to its definition, a loop-sentinel can only be used for the definition of a sequence containing a *numeric* type or a *dateTime* type.

For a *numeric* type, the *seed*, *step* and *terminal* attributes are defined as *numeric* scalars. In the case of a sequence containing scalar with a *dateTime* type, then the attributes *seed* and *terminal* are *dateTime* but the *step* is a *duration*.
For a *numeric* type, the *seed*, *step* and *terminal* attributes are defined as *numeric* scalars. In the case of a sequence containing scalar with a *dateTime* type, then the attributes *seed* and *terminal* are *dateTime* but the *step* is a *duration*.

### Half-open

It's possible to define a sentinel loop where the terminal value shouldn't be included in the sequence. This is done by setting the xml attribute *interval* to the value *half-open*.

Expl:

* A sequence, with the interval set to half-open, having for seed the value 1, for step the value 1 and for terminal the value 5 will have 4 elements having for values 1,2,3 and 4.
* A sequence, with the interval set to half-open, having for seed the value 1 for step the value 2, and for terminal the value 5 will have 2 elements having for values 1 and 3.
* A sequence, with the interval set to half-open, having for seed the value 1 for step the value 3, and for terminal the value 5 will have 2 elements having for values 1 and 4.
6 changes: 6 additions & 0 deletions _documentation/transform-column.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ Currently, you cannot assemble native transformations, it means that you're limi
* ```dateTime-to-first-of-year```: returns the first day of the year where a given date lies in.
* ```dateTime-to-last-of-month```: returns the last day of the month where a given date lies in.
* ```dateTime-to-last-of-year```: returns the last day of the year where a given date lies in.
* ```dateTime-to-next-day```: returns the next day.
* ```dateTime-to-previous-day```: returns the previous day.
* ```dateTime-to-next-month```: returns a dateTime corresponding to one month after the given date.
* ```dateTime-to-previous-month```: returns a dateTime corresponding to one month before the given date.
* ```dateTime-to-next-year```: returns a dateTime corresponding to one year after the given date.
* ```dateTime-to-previous-year```: returns a dateTime corresponding to one year before the given date.

The following transformations except parameters to operate. You must replace the information beween parenthesis with a string matching your expectation.

Expand Down

0 comments on commit cf32fc7

Please sign in to comment.