Open Test Framework
|
|
For professional users it is much more efficient to create and edit OTX in a code editor, especially for big OTX projects. EMOTIVE has developed OTL - Open Test Language. OTL is a Java-like scripting language for the OTX. Designer and code editor synchronize continuously. This allows to seamlessly switch between the two ways of working. The code editor has powerful syntax highlighting and auto complete features.
Note: OTL stands for Open Test Language. OTL is not a new programming language it is the ASCII code representation of the OTX data model. In other words OTL is equal to OTX.
The OTL syntax is similar to Java and DotNet. The OTL syntax for each element in the OTX reference is defined at each element, for example see Branch.
Tip: If the syntax is unclear, create the element inside the OTX Designer designer and look at the result in OTL editor.
Note: See Literals for an overview about OTX literals in OTL.
Note: There are some keywords, which shall not be used for names, see OTL Keywords!
Note: Comments that are common in other programming languages correspond to the specification of a node in OTL, see NamedAndSpecified. Comments cannot therefore be used freely because they are always bound to a node. If a comment is still required that should not be bound to a specific node, an action without realisation EmptyAction can be used, see code example:
To open an OTX document in the OTL editor, you can right click on the document node (or a procedure node in that document) inside the Solution Explorer and select the View code (OTL)
menu, or you can select the document node (or a procedure node in that document) and press F7
key.
The picture shows the different parts of the OTL code editor.
Show line numbers
menu. You can also switch the current view of the editor to a particular line number with the right click menu Go to line
or with the key shortcut CTRL + G
.'-'
indicates the beginning of the region while the line extending below the square box indicates the extent of the code region, the line ends with an edge '∟'
which marks the end of the block. For folded blocks, the toggle box is shown as '+'
with the '
...'. To collapse (hide) a code block, you can click on the box '-'
at the beginning of that block. To expand (show) a collapse block, you can click on the box '+'
or double clicking on the '
...' of that block. You can also collapse or expand all the code blocks by using the right click menu of the OTL editor or using the key shortcuts: Collapse All: CTRL + SHIFT + E
and expand all: CTRL + E
.Below are the context menus and their descriptions according to their positions from top to bottom.
Context menu entry | Keyboard shortcut | Description |
---|---|---|
Rename | CTRL + R | Renames the current declaration (allows update all references) which right is at the cursor (before, after or contains the cursor). |
Reformat document | CTRL + N | Deletes all the redundant spaces and resets the indentation in each line (NOTE: not deleting the empty lines). |
Generate document new | CTRL + SHIFT + N | Reloads the OTL at the last valid OTL code. |
New local variable | CTRL + L | Opens dialog to create new local variable and input the new variable at the cursor. |
Copy | CTRL + C | Copies all the highlighted text (1) or the current line (if no text is highlighted) (2). |
Cut | CTRL + X | Cuts all the highlighted text (1) or the current line (if no text is highlighted) (2). |
Paste | CTRL + V | Pastes the copied/cut highlighted text (1) at the cursor or the copied/cut line (2) in a new line above the current line.![the line where the cursor is.](Tooltip.png |
Show line numbers | Displays the line numbers (checked) or not (unchecked). | |
Show Tabs and Spaces | Displays all tabs and spaces to distinguish them. | |
Auto Word Wrap | CTRL + SHIFT + Enter | When activated, the portion of a long line that extends beyond the current width of the code editor window is displayed on the next line. |
Comment | CTRL + K | Comments all the lines with highlighted text or the current line (if no text is highlighted). |
Collapse all outlines | CTRL + SHIFT + E | Collapses all the collapsable blocks. |
Expanse all outlines | CTRL + E | Expanses all the collapsable blocks. |
Go to line | CTRL + G | Shows a dialog to input a particular number line to move view to. |
Display Procedure in designer | F7 | Deletes the current row/column. |
Toggle breakpoint | F9 | Toggles a breakpoint for the line on or off. |
Go to definition | F12 | Go to the definition of the selected declaration. |
Navigate backward | CTRL + - | Navigates backwards. |
Navigate forward | CTRL + SHIFT + - | Navigates forwards. |
The following case sensitive keywords are reserved inside OTL-Editor to express the language. They are not allowed for OTX names like declarations, procedures, signatures etc.
Note: This is a limitation of the toolset related to the OTX standard, because OTX allows such names. But there is a checker rule, which prevents the author from using such keywords. If an OTX document comes from another tool and it contains such keywords, it can be edited inside the designer normaly, but cannot be edited inside the OTL-Editor.
Note: It is recommended that names should be self-explained and declarations should have a number as suffix, like
contextVariable1
. This simple rules prevents the author from using keywords.
OTL Keywords (case sensitive) | ||||
---|---|---|---|---|
accessType | action | as | AssertThrows | base |
Boolean | break | catch | category | completedState |
const | ConstructorSignature | contentType | contextVariable | continue |
DeviceServiceSignature | DeviceSignature | do | else | EmptyAction |
EmptyBranch | EmptyExtensibleCompoundNode | EmptyExtensibleEndNode | EmptyGroup | EmptyHandler |
EmptyLoop | EmptyMutexGroup | EmptyParallel | entry | EnumerationSignature |
EventSignature | exit | FailTest | false | finally |
Float | for | foreach | group | id |
if | IgnoreTest | implements | import | in |
InconclusiveTest | Infinity | initialState | Integer | lane |
lang | List | Map | mutex | namespace |
NaN | NULL | out | package | parallel |
parameter | PassTest | private | procedure | ProcedureCall |
ProcedureSignature | public | realisation | ref | return |
ScreenSignature | ServiceProviderSignature | ServiceSignature | signature | space |
state | stateMachine | stateVariable | String | StructureSignature |
target | term | terminateLanes | throw | ThrowExceptionOnAmbiguousCall |
throws | transition | transitions | trigger | triggers |
true | try | validFor | validity | while |