Command overview
As you've seen in the previous example, the language supports a set of commands. There are three basic
groups:
- Desktop commands
represent user actions on the remote desktop.
- Connect
and Disconnect
connect to and disconnect from a desktop. The test script may be
connected to one desktop at a time. There's however no limitation on
how many desktops you connect to and disconnect from within one single
script and you may do a bit of automation on one system and then switch
to another one.
- Mouse
command performs a mouse move, press, release, click or drag.
- Press,
Type
and Typeline
commands deal with keyboard input. The Press one allows
to press virtually any key or a combination of key with one or more
modifiers (Shift, Ctrl, Alt, Windows). The Type and Typeline extend the Press command to type a
continuous text optionally followed by Enter (Typeline).
- Administration &
Execution Control commands provide necessary infrastructure for
test script execution control as well as support of variables,
libraries and external OS command calls.
- Var
and Eval
commands allow to define variables. While Var simply
assigns a string value to a variable, Eval expects the value to
contain a numeric expression, evaluates it and assigns the result to
the variable. Variables play an important role in script
parametrization and will be discussed in a separate topic.
- Run and Include
link other test scripts. While Run executes the
test script specified by the argument (including Java ones), Include
just makes all global variables and procedures in
the argument script available to the calling script. This allows you to
create libraries of common constants (variables) and tasks (procedures)
and link them as a library to multiple scripts. In version 2.2 and
higher Include also allows to load JAR files and made compiled Java
test scripts available for execution with Run.
- Pause,
Exit, Wait
and Break provide
unconditional ways to control script execution. Pause
pauses the script indefinitely until a human resumes it manually from
GUI or CLI. This is often used in together with the Sendmail
command (discussed further on) to pause a runaway script and and notify
the administrator that assistance is needed. Exit terminates the script, procedure or
a block of code and returns the numeric specified in the argument (zero
usually means success while other values indicate a failure). Wait
suspends script execution for a specified fixed amount of time.
Finally, Break is exclusively used to
terminate the innermost for
loop.
- Waitfor and Compareto
allow to wait for a specific event and act upon the result. Waitfor pauses execution of a script and
waits for a desktop event (such as screen update, bell or change of the
desktop clipboard content). It can also employ image comparison to test
the desktop image and pause the script until a certain image appears or
as long as an image is visible on the screen. Compareto
is solely used for one time image comparison.
- Exec executes a command of
the local operating system (meaning the system on which T-Plan Robot
runs, not the remote desktop one unless both the client and server run
on the same system). As result of the command as well as the console
output it produces are made available to the script as variables, it
may be optionally used to load small amounts of data and/or perform
output on the OS level (for example appending of text to a file).
- String
performs text operations such as search for a substring, matching with
another string or a regular expression, string cutting, parsing and
many more (Enterprise
version
2.2 and higher).
- Reporting commands
generate various automation outputs.
- Screenshot takes a screen
shot
of the desktop (or its part) and saves it to a file. As the command is
conveniently integrated with the Compareto one,
it may also take a screen shot and perform image comparison in one go.
- Warning creates a warning
log to be consumed by the report producer.
- Script and Step allow to
structure the test script to test cases (called "scripts" in T-Plan
terminology) and individual test steps. The structure is then reflected
in the test result XML and report. Referencing of an existing script in
T-Plan test management database also enables to export the test results
to T-Plan Professional (Enterprise
version
only).
- Report produces an HTML or
XML (Enterprise
version
only) report with test scripts results. The
report shows all outputs produced by the commands described above, such
as screen shots, warnings and step/script elements. Have a look at the report example.
- Sendmail sends an inline
E-mail from the script through an SMTP server. The body may be plain
text or HTML and the message may contain file attachments.
- Input/Output (I/O) commands
allow
to load data from or to store data to various resources (Enterprise
version
2.1 and higher).
- File
reads from
and writes to plain text files and files in the Comma Separated Values
(CSV) format.
- Excel
reads from
and writes to MS Excel spread sheets (.xls).
TIP: You
should have just a general knowledge of the available commands. The GUI
and especially the Script Editor
are well equipped to help you to design the code and it will be
discussed in one of the following topics.
|