Task Parameters

Report and Data Processing tasks can accept parameters. The purpose of parameterizing tasks is increase flexibility by moving some of the decisions from the underlying collateral (report or import sheet) to the task configuration. A parameterized report can be reused in several different test cases, saving the cost of building and maintaining multiple different reports. For example, a report fetching the position for a particular portfolio and date can be parameterized and reused multiple times to fetch the position for various portfolios and dates.

Similarly, an import sheet designed to simulate front office FX trading in a particular currency can be parameterized and reused to simulate FX trading in several different currencies, with various counterparties etc.

πŸ“˜

Accepted parameters are defined in the report or import sheet, as is the logic for how the parameter should be used. Autotest presents the parameters accepted by the underlying collateral and allows you to populate them with values in various ways.

Task parameter values are set in the task configuration of a report or data processing task.

851

Configuration of a parameterized report task

Parameters accepted by the source file are presented when the source is selected. The default value of each parameter is shown in the column Value; Parameter that don’t have a default value are mandatory to populate.

There are three ways to populate the value of a parameter:

  • Setting a static value
  • Linking to a variable
  • By expression

These are presented as separate options in the Value Type column.

Static value parameters

The simplest way to populate a parameter with a value is to set a static value. The static value is defined per task and is invariant over time or as the task is moved around in the test plan.

To set a static value:

  1. Select Value from the Value Type field of the parameter.
  2. Select or type in a value in the Value field.
681

Examples of parameters populated with static values

There are several parameter types, String, Decimal, Integer, Boolean etc. The Value field will prevent you from entering a value in a faulty format, such as β€œtext” into a Decimal column.

Variable linked parameters

Parameters can also be linked to variables for added flexibility. The parameter is populated with whatever value the variable has when the task is executing.

This is particularly useful if several tasks within the same test case or test plan branch requires the use of the same value, or when you have multiple references to the same test cases requiring slightly different parameter values; You can provide different variable values per reference, adjusting the behavior as needed.

To link a parameter to a variable:

  1. Select Variable from the Value Type field.
  2. Select the appropriate variable in the Value field.
852

Example of linking a parameter to a variable

Expression linked parameters

The final way to populate parameters with values is to use expressions. Expressions are evaluated when the task executes, and lets you derive values from e.g. variable values. This is useful in many cases, for example to minimize the number of variables needed. A typical example is when your test plan simulates e.g. a one-month cycle starting at some date. You can then define the start of the cycle as a variable and let any tasks within that cycle use values as offsets from the cycle start date.

To populate a parameter with an expression:

  1. Select Expression in the Value Type field.
  2. Enter an expression into the Value column.
854

Report using the Date Parameter linked to an Expression

Variables are referenced in expressions using the syntax $Variable Name$.

In the above example, a report is run with the Date parameter calculated as an offset from the Opening Date variable. In other scenarios you could use for example an expression such as AddDays(Now(), 7) to calculate an offset from the date/time of execution.

Calculated Value

The Calculated Value shows the effective value of the parameter linked to a variable or expression. The column is empty and can be populated or refreshed by clicking the refresh button in the column header. This is useful to see the exact input value used when running the task.