Screen actions reference

From ITR Wiki

Actions are the building blocks that make a test respond to the candidate. A button that goes to the next screen, a link that jumps back to the start, a check that shows a message when something is missing: these are all actions. You put them together in the test editor, without writing a full script.

Where you use actions

A screen template can have a variable of the type List of actions (see Test screen template introduction). Buttons and similar components use it. In the test editor you then build a small list of actions for that component, step by step. When the candidate clicks the button, the ITR runs the actions from top to bottom.

In the list you choose each action from a menu. The actions are grouped by category: Programming, Session, Test, User and User Interface. Some actions have settings, such as the screen to go to or the message to show.

Session actions

Action What it does
Store Stores the current answers in the database.
AutoStore Stores the current answers in the database. The ITR also does this automatically every minute.
CheckSessionTime Checks the session end date and time as set on the session. When the session end is enforced, the ITR also checks this by itself while the candidate works through the test.
EndSession Ends the current session.
UpdateCurrentScreenFromSessionStorage Fills the current screen with the answers that are stored at session level, for example answers given in an earlier test of the same session.

Test actions

Action What it does
NextScreen Goes to the next screen.
NextScreenIfAnswered Goes to the next screen if the current screen is answered.
NextUnansweredScreen Goes to the next unanswered screen, or stays on the current screen if it is not answered yet.
NextUnansweredScreenWithProceed Goes to the next unanswered screen.
PreviousScreen Goes to the previous screen.
GotoScreen Goes to a specific screen. Setting: the screen (by name).
ShowItem Shows or hides a component on the current screen. Settings: the component, hide instead of show, and whether to first reset the show status of all components.
EndTest Ends the current test. If there are more tests in the session, the next test starts.
EndTestTimeOut Ends the test because the time is up.

Moving to another screen only happens when the screen validations of the current screen are fine. The candidate gets a message otherwise. PreviousScreen and EndTestTimeOut do not wait for the validations.

User and user interface actions

Action What it does
Logout Saves the answers and logs the candidate out. The candidate can log in later and continue.
ShowMessage Shows a message in a popup. Settings: the message (translated with the test), an additional text that is not translated and may contain %%...%% fields, and the type: information, warning or error.
ShowScrollbars Shows or hides the scrollbars of the browser window. Settings: hide the horizontal and/or the vertical scrollbars instead of showing them.
Regenerate screen Draws the screen again, with the changes made by the earlier actions.
GetComponentValue Reads the value of a component on the current screen and stores it in a variable. Settings: the component, the type (the current value entered by the candidate or the configured value from the test editor) and the variable name.

Programming actions

With these actions you can make decisions and repeat steps, a bit like a small program.

Action What it does
None Does nothing. Useful as a placeholder.
Stop Stops running the actions and waits for the next click of the candidate.
If Runs the following actions only when the expression is true. When you add an If, the ITR adds the matching Else and EndIf steps for you. An ElseIf step checks another expression when the earlier ones were false.
Loop Repeats the actions up to the matching EndLoop as long as the expression (Loop while) is true.
Assign Assigns the result of an expression to a variable in context.vars.

Expressions and variables

The expressions of If, ElseIf, Loop and Assign are JavaScript expressions. Inside them you can use the object context:

context.vars
Your own variables for this test. They are kept with the test of the candidate, so they survive a page change and a new login. Assign and GetComponentValue write here.
context.sessionVars
Your own variables for the whole session, shared by all tests in the session.
context.currentSessionTest, context.currentSession, context.currentTestDefinition
The test of the candidate, the session and the test definition, as described in the Scripting reference.
context.currentScreen
The screen that is shown.

A small example: count how often a button is pressed and show a message after the third time.

  1. Assign count = (context.vars.count || 0) + 1
  2. If context.vars.count >= 3
  3. ShowMessage You have tried three times. Please ask the test supervisor for help.
  4. Else (left empty)
  5. EndIf

When Assign gets an empty expression and the variable already exists, the variable keeps its value. That is a handy way to declare a variable once.

Actions from plugins

Plugins and screen templates can register additional actions. They appear in the same menu, in their own category. Some of them are only available when the matching screen template is on the screen.

Where to go next