8 Reference Time Series - essenius/FitNesseFitSharpSupportFunctions GitHub Wiki

Time Series

The Time Series object is a representation of time series data. It has a script table interface for configuration, and a decision table interface to specify the values if required.

Script table interface

The script header can contain the CSV file to be loaded:

|Script|Time Series|MyData.csv|
Is Good Column
Description: Specify the name of the column holding the ‘is good’ values
In: column header
Out: -
Example: | Set Is Good Column | Quality |
Note: If this command is omitted, the default IsGood is used (casing doesn’t matter).
File Name
Description: The name of the loaded file
In: -
Out: The file name
Load
Description: Load the file specified by Path. Does nothing if Path is null or empty.
In: -
Out: -
Example: | Load |
Note: Is done implicitly by executing a Time Series Comparison, so should normally not be needed
Path
Description: Shows the file name in use for this data set. Can be empty if the data is constructed via the Decision table interface.
In: [new path specification]
Out: File name in use, or null if not using a file.
Example: | Set Path | MyData.csv |
Note: If a new path is specified, it will not be loaded by default.
Timestamp Column
Description: Specify the name of the column holding the timestamp values
In: column header
Out: -
Example: | Set Timestamp Column | DateAndTime |
Note: If this command is omitted, the default Timestamp is used (casing doesn’t matter).
Value Column
Description: Specify the name of the column holding the data values
In: column header
Out: -
Example: | Set Value Column | Actual Values |
Note: If this command is omitted, the default Value is used (casing doesn’t matter).

Decision table interface

The decision table interface allows you to specify a series of data points:

|Decision: Time Series  |
|Timestamp|Value|Is Good|

Time Series Comparison

Script Table Interface

The header looks as follows:

|Script: Time Series Comparison|Expected time series|Actual time series|Tolerance|

The Time Series Comparison constructor has two mandatory parameters Expected time series and Actual time series. Those can be the name of a CSV file, or a FitNesse symbol containing a Time Series object. There is also an optional parameter Tolerance, which can be one or more occurrences of a tolerance specification, separated by semicolons (;). A tolerance specification is a double for absolute values, or a double followed by the percent sign (%) for relative values compared to the range of the expected data. The tolerance cell can be omitted; then a tolerance of 0 is assumed. You can also specify a precision for a tolerance value by adding a colon (:) and the number of significant digits.

Base Timestamp
Description: Returns the timestamp of the first data point
In: -
Out: timestamp
Example: | Show | Base Timestamp |
Note: If a comparison hasn’t been done yet, it will attempt to do so first.
Failure Count
Description: Returns the number of failures in the comparison.
In: -
Out: number of data points with a comparison failure in it.
Example: | Check | Failure Count | 0 |
Note: If a comparison hasn’t been done yet, it will attempt to do so first.
Graph
Description: Return an html img element with an in-line base-64 html image containing a chart of the comparison. This can be displayed as the result of a FitNesse Show command.
In: [parameter table] – a list of parameters overriding default values (see separate table)
Out: Chart
Example: | Show | Graph |
| Show | Graph | !{width:768, height:360} |
Note: If a comparison hasn’t been done yet, it will attempt to do so first.
Graph X
Description: Shorthand for Graph with a certain width and height; other parameters default
In: width, height
Out: Chart
Example: | Show | Graph | 480 | x | 240 |
Max Value
Description: Returns the maximal value of the time series (if numerical).
In: -
Out: maximal value of the time series
Example: | Check | Max Value | < 2.0 |
Note: If the time series is non-numerical, return value is 0. If a comparison hasn’t been done yet, it will attempt to do so first.
Min Value
Description: Returns the minimal value of the time series (if numerical)
In: -
Out: minimal value of the time series
Example: | Check | Min Value | <= -1.0 |
Note: If the time series is non-numerical, return value is 0. If a comparison hasn’t been done yet, it will attempt to do so first.
Point Count
Description: Returns the number of data points in the comparison.
In: -
Out: number of data points
Example: | Check | Point Count | >0 |
Note: If a comparison hasn’t been done yet, it will attempt to do so first.
Run Comparison
Description: Triggers a new run of the comparison.
In: -
Out: number of data points with a comparison failure in it.
Example: | Check | Run Comparison
Note: Should normally not be needed explicitly as the other functions call this if needed.
Time Span Seconds
Description: Time span in seconds between first and last data point
In: -
Out: number of seconds
Example: | Show | Time Span Seconds |
Used Tolerance
Description: The tolerance used in the comparison
In: -
Out: tolerance used
Example: | Show | Used Tolerance |

Graph parameters

Note: the parameter names are not case sensitive and can contain spaces.

Parameter Meaning Default
Width width of the graph in pixels 800
Height height of the graph in pixels 600
StartTimestamp Timestamp value to use as the first data point of the chart Timestamp of the first data point in the time series
EndTimestamp Timestamp value to use as the last point of the chart Timestamp of the last data point in the time series
MinValue Minimal value to show on the chart Minimal value, rounded to nearest lower tickmark
Maxvalue Maximal value to show on the chart Maximal time series value, rounded to nearest higher tickmark

Table Table interface

The Time Series Comparison object also exposes a Table Table interface to provide full details about the comparison. It can be called without using the script interface; then its layout is as follows:

|Table: Time Series Comparison|Expected time series|Actual time series|Tolerance|

It is also possible to use the interface on an existing script table. Save the fixture object to a symbol via the get fixture command, and then specify just the fixture as the table header:

|Table: $comparisonObject|

⚠️ **GitHub.com Fallback** ⚠️