Flow Control¶
The FlowControl class manages control flow operations including loops, conditions, and data management for test sessions.
Read Data¶
The read_data method loads tabular data from a file path, an environment variable (using the ENV:VAR_NAME form), or a 2D list; applies optional query parts such as select=col1,col2 and filter expressions; and stores the result in the session's elements. For full details on the ENV: prefix, query syntax (including variable resolution ${var}), and all supported file_path forms, see Read Data in Keyword Usage.
optics_framework.api.flow_control.FlowControl ¶
Manages control flow operations (loops, conditions, data) for a session.
condition(*args) ¶
Evaluates conditions and executes corresponding targets.
date_evaluate(param1, param2, param3, param4='%d %B') ¶
Evaluates a date expression based on an input date and stores the result in session.elements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
param1 | str | The variable name (placeholder) where the evaluated date result will be stored. | required |
param2 | str | The input date string (e.g., "04/25/2025" or "2025-04-25"). Format is auto-detected. | required |
param3 | str | The date expression to evaluate, such as "+1 day", "-2 days", or "today". | required |
param4 | Optional[str] | The output format for the evaluated date (default is "%d %B", e.g., "26 April"). | '%d %B' |
Returns:
| Name | Type | Description |
|---|---|---|
str | str | The resulting evaluated and formatted date string. |
Raises:
| Type | Description |
|---|---|
ValueError | If the session is not present, the input date format cannot be detected, or the expression format is invalid. |
Example
date_evaluate("tomorrow", "04/25/2025", "+1 day") ➔ Stores "26 April" in session.elements["tomorrow"]
evaluate(param1, param2) ¶
Evaluates an expression and stores the result in session.elements.
execute_module(module_name) ¶
Executes a module's keywords using the session's keyword_map.
invoke_api(api_identifier) ¶
Invokes an API call based on a definition from the session's API data.
read_data(input_element, file_path, query='') ¶
Reads tabular data from a CSV file, JSON file, environment variable, or a 2D list, applies optional filtering and column selection, and stores the result in the session's elements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_element | str | Variable name where the result is stored (e.g. | required |
file_path | Union[str, List[Any]] | Data source. One of: (1) path to a | required |
query | str | Optional semicolon-separated parts: | '' |
Returns:
| Type | Description |
|---|---|
List[Any] | The stored value as a list (or list of lists for multi-row results). Also writes into |
List[Any] |
|
run_loop(target, *args) ¶
Runs a loop over a target module, either by count or with variables.