Open Test Framework - Expression Editor

From emotive
Jump to: navigation, search


With the Expression Editor, a simple or a complex OTX term can be created without writing OTX code, see the image below. An OTX term may consist of many terms and different operators (i.e. operators and terms can be nested), and it has exactly one return value of a defined data type. All the OTX terms are categorized in the editor according to the OTX libraries (OTX Core and other OTX extensions). To open the Expression Editor, you can select the "<Expression>..." menu item in the combo box of a property in the properties window. With the Assignment activity, you can easily access the Expression Editor by clicking on the wrench icon ("Wrench.png") on the Assignment in the workflow.

Expression Editor Features

The Expression Editor consists of the expression box in the upper part and the selection box in the lower part, see image.

ExpressionEditor.png
Expression Editor allows for creating and editing OTX terms

Expression Box

In the expression box, the OTX terms can be freely created and edited using the keyboard.

Supported Operators

The operators can be entered in the expression box by using the keyboard. For example the "+" operator:

LengthOfString(Variable1) + 5

The Expression Editor supports the selection of the following important operators:

Operator Description
+ Additions
- Subtraction
* Multiplication
/ Division
% Modulo, calculates the remainder after dividing its first operand by its second
& Bitwise AND combination
| Bitwise OR combination
^ Bitwise XOR combination
&& Logic AND
|| Logic OR
== Equal
!= Unequal
>= Greater than or equal
<= Less than or equal
> Greater than
< Less than

Selection Box

In the selection box below the supported operators, all the available declarations, parameters, validities and OTX terms (also user-defined terms) are listed in groups. To insert a term or a declaration at the current cursor position in the Expression Editor, you only need to double-click on that term or declaration in the selection box.

Terms

A term has the following basic structure:

«result» = Name(«arg1», «arg2», «...», «argN»)

At the time of execution, each term returns a «result». Each term contains arguments «arg», and each argument can be replaced with a literal value (or a literal expression), a declaration or another term, note that the data of the input declarations shall not be changed by the calculation.

Adding an Expression

To add an expression of OTX term to a property of an activity, please proceed as follows:

  1. Open the properties window to view the properties of the activity
  2. Select the "<Expression>..." menu item in the combo box of the property you want to add the expression
  3. Find the appropriate term in the selection box
  4. Double-clicking on the term to insert it at the current cursor point in the Expression Editor
  5. Click on one of the arguments of the term
  6. Find and double-click on a declaration or a term to input for the argument
  7. Do the same for all the other arguments, you can delete the optional arguments
  8. Add operators by manually typing on the keyboard (if necessary)
  9. Add more terms and declarations etc.
  10. Apply the expression to the property via the OK button.