-
Notifications
You must be signed in to change notification settings - Fork 0
Macros & Expressions
roBob supports macros in order to template the creation of specification files. A typical macro has the following format and can appear anywhere in your specification file:
${property}A property name can only contain alphanumerical characters and the symbols . and _. Anything else will be considered an expression and will lead into unexpected problems.
Properties are grouped in different namespaces:
- app. - Current application properties
- app.[name]. - Specific application properties
- node. - Current node properties
- node.[name]. - Specific node properties
- parser. - Current parser properties
- parser.[name]. - Specific parser properties
- stream. - Current stream properties
- stream.[name]. - Specific stream properties
- metric.[name]. - Specific metric properties
- report. - Report properties
- curr. - Current values of the test-case parameters
In addition, the following properties are automatically exposed in the global namespace:
- All properties in the
globalsection - The current values of the test-case
- Properties defined in a
definesection in anapp,stream, orparser
You can also specify a default value when evaluating a macro. To do so, you can use the | character:
${property.name|default_value}You can also evaluate simple expressions inside a macro. An expression is considered a macro that contains any character of the following: ()+-/*^%. For example:
${property.name * another.property}
${property.size / 4}
${first.property + second.property / (third.property * fourth.property)}The following functions are also available: str(), int(), float(), round() and pow().